time(0) returns the current time in whatever representation your system
uses. 'gmtime' is supposed to be able to convert whatever the system uses
into a representation based on UTC. So UnixTime(time(0)) will return the
number of seconds passed since 1970-01-01T00:00+0:00 (the Unix epoch).
That's assuming your clock's in sync :-).
BTW: look at mkgmtime in cgi.c. The assumption that time_t is seconds
after the Unix Epoch is assumed there. Trying to write a fully portable
implementation of that thing will only give you grief.
You should probably ignore all my rambling and directly use the result of
time(0). It doubt there's a system out there that can compile Fossil _and_
uses a different representation of time.
Gé
On Sat, 17 Sep 2011, Stephan Beal wrote:
On Sat, Sep 17, 2011 at 12:25 AM, Gé Weijers <g...@weijers.org> wrote:
long UnixTime(time_t now)
{
struct tm *p = gmtime(&now);
but now the question: if time(0) returns time in either GMT or local TZ, how
can i know which value to pass to UnixTime()?
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users