[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] strptime not in MinGW time.h

From: Stephen Leake
Subject: Re: [Monotone-devel] strptime not in MinGW time.h
Date: Fri, 21 May 2010 05:24:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)

Derek Scherger <address@hidden> writes:

> On Thu, May 20, 2010 at 5:04 AM, Stephen Leake <
> address@hidden> wrote:
>> It's currently dying with some mysterious C messages:
>> These do _not_ look easy to fix.
>> So I'm looking at where strptime is used, to see what the impact of this
>> is.
>> It's used in three places:
>> get_log_message_interactively, if date_fmt is not empty
>> status, to check that date_fmt is compatible with
>> get_log_message_interactively
>> commit, to check that date_fmt is compatible with something (I'm not sure
>> what)
> With the new changelog editor you may edit the Date: header as part of a
> commit, strptime is used to parse the date from the commit editor. The
> format is deemed to be acceptable if the current date is unchanged after
> being formatted and parsed with it.
> date_fmt is set by the user, via a command line option or
>> hook_get_date_format_spec.
>> So this is in support of user-configurable date formats.
> ... used in the changelog editor, as far as I know nothing else uses
> strptime to parse dates.

Ok, good.

>> How important is that?
>> Perhaps we could simply say "user-configurable date formats not
>> available on Win32". I'm ok with that.
> Or "editing the Date: header is unsupported on Win32"

Ok, I'll see if I can make this work. Then we can release, and come up
with a better solution later.

One option would be to find Microsoft's date parsing function (there
must be one somewhere) and use a platform.hh wrapper. I tried searching
for "parse date" on MSDN, and got over 1,000 hits; the first couple of
pages were all in .NET or Visual Basic or some other high level layer.
There does not seem to be a way to restrict the search to "plain C API"!
So I gave up.

Anticipating that, and as a clean way to avoid the compilation error,
I'll add a wrapper "parse_date" in platform.hh now, making it take the
same parameters as strptime. The Win32 version will throw an error. Hmm.
Maybe it needs to support only a "standard" format instead?

I'll also see if this compiles on Cygwin. Has anyone compiled on Mac
since the changelog editor landed?

Hmm. I just did some wider web searching, and found this:

Apparently Win32 can convert a SystemTime struct to a formatted string,
but cannot then parse the string. Which explains why every higher-level
package has its own way of parsing dates. Wonderfull.

Boost has a Date_Time library, but I suspect we don't want to go there.

-- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]