On Fri, Sep 16, 2011 at 3:21 PM, Stephan Beal <sgb...@googlemail.com> wrote:

> On Fri, Sep 16, 2011 at 9:16 PM, Richard Hipp <d...@sqlite.org> wrote:
>
>> db_int64(0, "SELECT strftime('%%s','now')");
>>
>
> i forgot to mention (well, forgot period), that i'm doing this at a point
> which might be called before the db is opened, e.g. to report a db-opening
> error or some error which happens before the db is opened. (The timestamp is
> part of the JSON response envelope.)
>
> i've got:
>
>     cson_int_t jsTime;
>     time_t const t = (time_t)time(0);
>

time(0) should give you UTC directly.  No need to convert.



>     struct tm gt = *gmtime(&t);
>     gt.tm_isdst = -1;
>     jsTime = (cson_int_t)mktime(&gt);
>
> but i'm not 100% certain whether that's correct. i'm 95% certain, but not
> 100%.
>
> --
> ----- 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
>
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to