[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Re: dates in monotone
From: |
Markus Wanner |
Subject: |
[Monotone-devel] Re: dates in monotone |
Date: |
Thu, 16 Oct 2008 18:42:47 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080916) |
Hi,
Zack Weinberg wrote:
> 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.
Understood.
> So please don't create new situations where Unix-epoch second counts
> are stored on disk or transmitted over the net.
Uhm.. yeah, I've created such a situation in date_t::now(). Thanks for
pointing that out.
In rev af1cd9d04a3cabab86dc14c8167ff5e83b26d6a6, I've reverted that to
using the system's gmtime() to gain a struct tm, which is independent of
the system's epoch. Instead of creating a date string from there, I'm
now using our own date_t::mktime() function, which is guaranteed to use
Unix epochs.
Regards
Markus Wanner