Differences From:
File
src/timeline.c
part of check-in
[e8c4f69c50]
- Change all mentions of "UUID" in the documentation and help screens into
either "artifact ID" or "baseline ID" or "ticket ID" as appropriate. "UUID"
has a widely recognized meaning that is different from its meaning in
fossil. "UUID" is still used in code comments and in variable names.
by
drh on
2008-10-24 13:27:53.
[view]
To:
File
src/timeline.c
part of check-in
[d23b8ba62b]
- Update SQLite to the latest in CVS (version 3.6.4+). Add a configuration
option to show all times in UTC instead of localtime.
by
drh on
2008-11-01 20:48:52.
[view]
@@ -24,8 +24,9 @@
** This file contains code to implement the timeline web page
**
*/
#include <string.h>
+#include <time.h>
#include "config.h"
#include "timeline.h"
/*
@@ -654,5 +655,29 @@
zSQL = mprintf("%z ORDER BY event.mtime DESC", zSQL);
db_prepare(&q, zSQL);
print_timeline(&q, n);
db_finalize(&q);
+}
+
+/*
+** This is a version of the "localtime()" function from the standard
+** C library. It converts a unix timestamp (seconds since 1970) into
+** a broken-out local time structure.
+**
+** This modified version of localtime() works like the library localtime()
+** by default. Except if the timeline-utc property is set, this routine
+** uses gmttime() instead. Thus by setting the timeline-utc property, we
+** can get all localtimes to be displayed at UTC time.
+*/
+struct tm *fossil_localtime(const time_t *clock){
+ static int once = 1;
+ static int useUtc = 0;
+ if( once ){
+ useUtc = db_get_int("timeline-utc", 0);
+ once = 0;
+ }
+ if( useUtc ){
+ return gmtime(clock);
+ }else{
+ return localtime(clock);
+ }
}