[LEAPSECS] Lets get REAL about time.

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Jan 24 03:22:41 EST 2012


In message <E1RpVVq-0001t0-15 at grus.atnf.CSIRO.AU>, Mark Calabretta writes:


>I offered the solution of providing a function to subtract two tm

>structs. It would be included with the realtime_t suite of routines

>even though it doesn't deal with realtime_t values. This is how the

>man page might start:

>

> int tmdiff(const struct tm *tm1, const struct tm *tm2, double *diff);

>

> Return the time interval, *tm2 - *tm1, in SI seconds.


ENOCANDO

At best you can return it as a "struct tm" recording the expected
difference.

For instance:

{2100-01-01 00:00:00Z} - {2012-01-01 00:00:00Z} = {88y}

... but we don't know how many seconds.

Ohh, and btw: That function is a hell to write and it will never
qualify as efficient...

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


More information about the LEAPSECS mailing list