bug-gnulib
[Top][All Lists]
Advanced

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

Re: time64: 64-bit variants of gmtime, mktime, localtime etc?


From: Paul Eggert
Subject: Re: time64: 64-bit variants of gmtime, mktime, localtime etc?
Date: Wed, 07 Mar 2007 09:32:36 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> What do people think about to offer a new set of modules that use
> 64-bit integers for time representation?
>
> I'm thinking a time64.h:
>
> #include <stdint.h>
> typedef int64_t time64_t;
> struct tm *gmtime_r(const time64_t *timep, struct tm *result);
> struct tm *localtime_r(const time64_t *timep, struct tm *result);
> time64_t mktime(struct tm *tm);
>
> With this module, packages that need support for years >2038 can use
> do this now, instead of waiting for time_t to be made larger in the
> compiler/OS they use.

I assume you'd be doing this from the glibc source?  And you'd check
that it works with the new 64-bit tzdata format?

Presumably the names would have to be changed to gmtime64_r or
something like that, to avoid collision.

It sounds doable, but how useful is it by itself?  I imagine that most
programs needing time64_t would also want functions like 'stat' to
work, but we can't fix them so easily.

While you're on the subject, why not change struct tm to struct tm64?
We might as well use a 64-bit year while we're at it, to avoid integer
overflow issues when converting time_t to struct tm.




reply via email to

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