monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] Re: dates in monotone


From: Zack Weinberg
Subject: [Monotone-devel] Re: dates in monotone
Date: Thu, 16 Oct 2008 08:56:35 -0700

On Thu, Oct 16, 2008 at 8:48 AM, Zack Weinberg <address@hidden> wrote:
> On Thu, Oct 16, 2008 at 7:07 AM, Markus Wanner <address@hidden> wrote:
>>
>> Are the mktime() and gmtime() system functions really that unusable for 
>> portable
>> software?
>
> Yes.  Some (not all) Windows C runtime libraries (or possibly
> operating system major releases, I didn't investigate this in detail)
> use a different epoch and/or don't implement the distinction between
> UTC and local time correctly.

I should add that this is only a problem because the CVS file format
uses Unix-epoch second counts as a storage representation.  The
standards say nothing about the epoch used by time_t; it's not even
guaranteed to be an arithmetic type!  The problematic Windows gmtime()
and mktime() are correct as long as they are used only in conjunction
with themselves and the rest of the <time.h> API -- you'll note that
date_t::now() does use time() and gmtime().  It is only when
interpreting integers defined by some external format to be Unix-epoch
second counts that we have to do the math by hand.

So please don't create new situations where Unix-epoch second counts
are stored on disk or transmitted over the net.

zw




reply via email to

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