Fossil SCM

dropped back to a simpler timestamp generation mechanism. Thanks to Ge Weijers for the input.

stephan 2011-09-17 01:25 UTC json
Commit 147f4bfb62bfb948b6a63fb60ec7a9327690cc54
1 file changed +8 -1
+8 -1
--- src/json.c
+++ src/json.c
@@ -558,12 +558,19 @@
558558
SET("fossil");
559559
560560
{/* "timestamp" */
561561
cson_int_t jsTime;
562562
#if 1
563
+ jsTime = (cson_int_t)time(0);
564
+#elif 1
563565
/* Ge Weijers has pointed out that time(0) commonly returns
564
- GMT, but is not required to by the standard.
566
+ UTC, but is not required to by The Standard.
567
+
568
+ There is a mkfmtime() function in cgi.c but it requires
569
+ a (tm *), and i don't have that without calling gmtime()
570
+ or populating the tm myself (which is what i'm trying to
571
+ have done for me!).
565572
*/
566573
time_t const t = (time_t)time(0);
567574
struct tm gt = *gmtime(&t);
568575
gt.tm_isdst = -1;
569576
jsTime = (cson_int_t)mktime(&gt);
570577
--- src/json.c
+++ src/json.c
@@ -558,12 +558,19 @@
558 SET("fossil");
559
560 {/* "timestamp" */
561 cson_int_t jsTime;
562 #if 1
 
 
563 /* Ge Weijers has pointed out that time(0) commonly returns
564 GMT, but is not required to by the standard.
 
 
 
 
 
565 */
566 time_t const t = (time_t)time(0);
567 struct tm gt = *gmtime(&t);
568 gt.tm_isdst = -1;
569 jsTime = (cson_int_t)mktime(&gt);
570
--- src/json.c
+++ src/json.c
@@ -558,12 +558,19 @@
558 SET("fossil");
559
560 {/* "timestamp" */
561 cson_int_t jsTime;
562 #if 1
563 jsTime = (cson_int_t)time(0);
564 #elif 1
565 /* Ge Weijers has pointed out that time(0) commonly returns
566 UTC, but is not required to by The Standard.
567
568 There is a mkfmtime() function in cgi.c but it requires
569 a (tm *), and i don't have that without calling gmtime()
570 or populating the tm myself (which is what i'm trying to
571 have done for me!).
572 */
573 time_t const t = (time_t)time(0);
574 struct tm gt = *gmtime(&t);
575 gt.tm_isdst = -1;
576 jsTime = (cson_int_t)mktime(&gt);
577

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button