Fossil SCM

Make UTC time display the default. You can still set up a server to show localtime but that requires changing a setting under setup/timeline.

drh 2008-11-01 20:56 trunk
Commit 0b36f02f158e46419a0d693dfcbb42773f2e27d0
+1
--- src/main.c
+++ src/main.c
@@ -76,10 +76,11 @@
7676
int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
7777
Th_Interp *interp; /* The TH1 interpreter */
7878
FILE *httpIn; /* Accept HTTP input from here */
7979
FILE *httpOut; /* Send HTTP output here */
8080
int xlinkClusterOnly; /* Set when cloning. Only process clusters */
81
+ int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */
8182
8283
int *aCommitFile; /* Array of files to be committed */
8384
8485
int urlIsFile; /* True if a "file:" url */
8586
char *urlName; /* Hostname for http: or filename for file: */
8687
--- src/main.c
+++ src/main.c
@@ -76,10 +76,11 @@
76 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
77 Th_Interp *interp; /* The TH1 interpreter */
78 FILE *httpIn; /* Accept HTTP input from here */
79 FILE *httpOut; /* Send HTTP output here */
80 int xlinkClusterOnly; /* Set when cloning. Only process clusters */
 
81
82 int *aCommitFile; /* Array of files to be committed */
83
84 int urlIsFile; /* True if a "file:" url */
85 char *urlName; /* Hostname for http: or filename for file: */
86
--- src/main.c
+++ src/main.c
@@ -76,10 +76,11 @@
76 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
77 Th_Interp *interp; /* The TH1 interpreter */
78 FILE *httpIn; /* Accept HTTP input from here */
79 FILE *httpOut; /* Send HTTP output here */
80 int xlinkClusterOnly; /* Set when cloning. Only process clusters */
81 int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */
82
83 int *aCommitFile; /* Array of files to be committed */
84
85 int urlIsFile; /* True if a "file:" url */
86 char *urlName; /* Hostname for http: or filename for file: */
87
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -670,11 +670,11 @@
670670
@ <p>In timeline displays, check-in comments can be displayed with or
671671
@ without block markup (paragraphs, tables, etc.)</p>
672672
673673
@ <hr>
674674
onoff_attribute("Use Universal Coordinated Time (UTC)",
675
- "timeline-utc", "utc", 0);
675
+ "timeline-utc", "utc", 1);
676676
@ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
677677
@ Zulu) instead of in local time.</p>
678678
679679
@ <hr>
680680
entry_attribute("Max timeline comment length", 6,
681681
--- src/setup.c
+++ src/setup.c
@@ -670,11 +670,11 @@
670 @ <p>In timeline displays, check-in comments can be displayed with or
671 @ without block markup (paragraphs, tables, etc.)</p>
672
673 @ <hr>
674 onoff_attribute("Use Universal Coordinated Time (UTC)",
675 "timeline-utc", "utc", 0);
676 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
677 @ Zulu) instead of in local time.</p>
678
679 @ <hr>
680 entry_attribute("Max timeline comment length", 6,
681
--- src/setup.c
+++ src/setup.c
@@ -670,11 +670,11 @@
670 @ <p>In timeline displays, check-in comments can be displayed with or
671 @ without block markup (paragraphs, tables, etc.)</p>
672
673 @ <hr>
674 onoff_attribute("Use Universal Coordinated Time (UTC)",
675 "timeline-utc", "utc", 1);
676 @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
677 @ Zulu) instead of in local time.</p>
678
679 @ <hr>
680 entry_attribute("Max timeline comment length", 6,
681
+7 -6
--- src/timeline.c
+++ src/timeline.c
@@ -667,17 +667,18 @@
667667
** by default. Except if the timeline-utc property is set, this routine
668668
** uses gmttime() instead. Thus by setting the timeline-utc property, we
669669
** can get all localtimes to be displayed at UTC time.
670670
*/
671671
struct tm *fossil_localtime(const time_t *clock){
672
- static int once = 1;
673
- static int useUtc = 0;
674
- if( once ){
675
- useUtc = db_get_int("timeline-utc", 0);
676
- once = 0;
672
+ if( g.fTimeFormat==0 ){
673
+ if( db_get_int("timeline-utc", 1) ){
674
+ g.fTimeFormat = 1;
675
+ }else{
676
+ g.fTimeFormat = 2;
677
+ }
677678
}
678
- if( useUtc ){
679
+ if( g.fTimeFormat==1 ){
679680
return gmtime(clock);
680681
}else{
681682
return localtime(clock);
682683
}
683684
}
684685
--- src/timeline.c
+++ src/timeline.c
@@ -667,17 +667,18 @@
667 ** by default. Except if the timeline-utc property is set, this routine
668 ** uses gmttime() instead. Thus by setting the timeline-utc property, we
669 ** can get all localtimes to be displayed at UTC time.
670 */
671 struct tm *fossil_localtime(const time_t *clock){
672 static int once = 1;
673 static int useUtc = 0;
674 if( once ){
675 useUtc = db_get_int("timeline-utc", 0);
676 once = 0;
 
677 }
678 if( useUtc ){
679 return gmtime(clock);
680 }else{
681 return localtime(clock);
682 }
683 }
684
--- src/timeline.c
+++ src/timeline.c
@@ -667,17 +667,18 @@
667 ** by default. Except if the timeline-utc property is set, this routine
668 ** uses gmttime() instead. Thus by setting the timeline-utc property, we
669 ** can get all localtimes to be displayed at UTC time.
670 */
671 struct tm *fossil_localtime(const time_t *clock){
672 if( g.fTimeFormat==0 ){
673 if( db_get_int("timeline-utc", 1) ){
674 g.fTimeFormat = 1;
675 }else{
676 g.fTimeFormat = 2;
677 }
678 }
679 if( g.fTimeFormat==1 ){
680 return gmtime(clock);
681 }else{
682 return localtime(clock);
683 }
684 }
685

Keyboard Shortcuts

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