Fossil SCM
(experimental) Allow not only --utc or --localtime to be specified, but any timezone (minutes from UTC = -999...999)
Commit
c3e3ceb9b645ffeed56f02eccee437b282803073
Parent
167b24c744258b7…
2 files changed
+11
-3
+13
-7
+11
-3
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -161,11 +161,12 @@ | ||
| 161 | 161 | Th_Interp *interp; /* The TH1 interpreter */ |
| 162 | 162 | char *th1Setup; /* The TH1 post-creation setup script, if any */ |
| 163 | 163 | FILE *httpIn; /* Accept HTTP input from here */ |
| 164 | 164 | FILE *httpOut; /* Send HTTP output here */ |
| 165 | 165 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 166 | - int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ | |
| 166 | + int fTimeFormat; /* 1000 for UTC. -1000 for localtime. 0 not yet selected */ | |
| 167 | + /* -999...999 = minutes difference from UTC */ | |
| 167 | 168 | int *aCommitFile; /* Array of files to be committed */ |
| 168 | 169 | int markPrivate; /* All new artifacts are private if true */ |
| 169 | 170 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 170 | 171 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 171 | 172 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| @@ -637,10 +638,11 @@ | ||
| 637 | 638 | "another flag and is treated as such. --args FILENAME may be used\n" |
| 638 | 639 | "in conjunction with any other flags.\n"); |
| 639 | 640 | fossil_exit(1); |
| 640 | 641 | }else{ |
| 641 | 642 | const char *zChdir = find_option("chdir",0,1); |
| 643 | + const char *zTimezone = find_option("tz",0,1); | |
| 642 | 644 | g.isHTTP = 0; |
| 643 | 645 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 644 | 646 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 645 | 647 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 646 | 648 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| @@ -651,12 +653,18 @@ | ||
| 651 | 653 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 652 | 654 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 653 | 655 | g.zLogin = find_option("user", "U", 1); |
| 654 | 656 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 655 | 657 | g.zErrlog = find_option("errorlog", 0, 1); |
| 656 | - if( find_option("utc",0,0) ) g.fTimeFormat = 1; | |
| 657 | - if( find_option("localtime",0,0) ) g.fTimeFormat = 2; | |
| 658 | + if( zTimezone ){ | |
| 659 | + int tz = (int)strtol(zTimezone, 0, 0); | |
| 660 | + if( tz<-999 || tz >999 ){ | |
| 661 | + fossil_fatal("wrong timezone format %s", zTimezone); | |
| 662 | + } | |
| 663 | + g.fTimeFormat = tz ? tz : 1000; | |
| 664 | + }else if( find_option("utc",0,0) ) g.fTimeFormat = 1000; | |
| 665 | + else if( find_option("localtime",0,0) ) g.fTimeFormat = -1000; | |
| 658 | 666 | if( zChdir && file_chdir(zChdir, 0) ){ |
| 659 | 667 | fossil_fatal("unable to change directories to %s", zChdir); |
| 660 | 668 | } |
| 661 | 669 | if( find_option("help",0,0)!=0 ){ |
| 662 | 670 | /* --help anywhere on the command line is translated into |
| 663 | 671 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -161,11 +161,12 @@ | |
| 161 | Th_Interp *interp; /* The TH1 interpreter */ |
| 162 | char *th1Setup; /* The TH1 post-creation setup script, if any */ |
| 163 | FILE *httpIn; /* Accept HTTP input from here */ |
| 164 | FILE *httpOut; /* Send HTTP output here */ |
| 165 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 166 | int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ |
| 167 | int *aCommitFile; /* Array of files to be committed */ |
| 168 | int markPrivate; /* All new artifacts are private if true */ |
| 169 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 170 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 171 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| @@ -637,10 +638,11 @@ | |
| 637 | "another flag and is treated as such. --args FILENAME may be used\n" |
| 638 | "in conjunction with any other flags.\n"); |
| 639 | fossil_exit(1); |
| 640 | }else{ |
| 641 | const char *zChdir = find_option("chdir",0,1); |
| 642 | g.isHTTP = 0; |
| 643 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 644 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 645 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 646 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| @@ -651,12 +653,18 @@ | |
| 651 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 652 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 653 | g.zLogin = find_option("user", "U", 1); |
| 654 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 655 | g.zErrlog = find_option("errorlog", 0, 1); |
| 656 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 657 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| 658 | if( zChdir && file_chdir(zChdir, 0) ){ |
| 659 | fossil_fatal("unable to change directories to %s", zChdir); |
| 660 | } |
| 661 | if( find_option("help",0,0)!=0 ){ |
| 662 | /* --help anywhere on the command line is translated into |
| 663 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -161,11 +161,12 @@ | |
| 161 | Th_Interp *interp; /* The TH1 interpreter */ |
| 162 | char *th1Setup; /* The TH1 post-creation setup script, if any */ |
| 163 | FILE *httpIn; /* Accept HTTP input from here */ |
| 164 | FILE *httpOut; /* Send HTTP output here */ |
| 165 | int xlinkClusterOnly; /* Set when cloning. Only process clusters */ |
| 166 | int fTimeFormat; /* 1000 for UTC. -1000 for localtime. 0 not yet selected */ |
| 167 | /* -999...999 = minutes difference from UTC */ |
| 168 | int *aCommitFile; /* Array of files to be committed */ |
| 169 | int markPrivate; /* All new artifacts are private if true */ |
| 170 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 171 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 172 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| @@ -637,10 +638,11 @@ | |
| 638 | "another flag and is treated as such. --args FILENAME may be used\n" |
| 639 | "in conjunction with any other flags.\n"); |
| 640 | fossil_exit(1); |
| 641 | }else{ |
| 642 | const char *zChdir = find_option("chdir",0,1); |
| 643 | const char *zTimezone = find_option("tz",0,1); |
| 644 | g.isHTTP = 0; |
| 645 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 646 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 647 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 648 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| @@ -651,12 +653,18 @@ | |
| 653 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 654 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 655 | g.zLogin = find_option("user", "U", 1); |
| 656 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 657 | g.zErrlog = find_option("errorlog", 0, 1); |
| 658 | if( zTimezone ){ |
| 659 | int tz = (int)strtol(zTimezone, 0, 0); |
| 660 | if( tz<-999 || tz >999 ){ |
| 661 | fossil_fatal("wrong timezone format %s", zTimezone); |
| 662 | } |
| 663 | g.fTimeFormat = tz ? tz : 1000; |
| 664 | }else if( find_option("utc",0,0) ) g.fTimeFormat = 1000; |
| 665 | else if( find_option("localtime",0,0) ) g.fTimeFormat = -1000; |
| 666 | if( zChdir && file_chdir(zChdir, 0) ){ |
| 667 | fossil_fatal("unable to change directories to %s", zChdir); |
| 668 | } |
| 669 | if( find_option("help",0,0)!=0 ){ |
| 670 | /* --help anywhere on the command line is translated into |
| 671 |
+13
-7
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1885,29 +1885,35 @@ | ||
| 1885 | 1885 | print_timeline(&q, n, width, verboseFlag); |
| 1886 | 1886 | db_finalize(&q); |
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | 1889 | /* |
| 1890 | -** Return one of two things: | |
| 1890 | +** Return one of three forms: | |
| 1891 | +** | |
| 1892 | +** ",'localtime'" when (server) localtime is desired | |
| 1891 | 1893 | ** |
| 1892 | -** ",'localtime'" if the timeline-utc property is set to 0. | |
| 1894 | +** "" when UTC is desired | |
| 1893 | 1895 | ** |
| 1894 | -** "" (empty string) otherwise. | |
| 1896 | +** ",'??? minutes'" otherwise | |
| 1895 | 1897 | */ |
| 1896 | 1898 | const char *timeline_utc(){ |
| 1899 | + static char buf[16] = ""; /* only initialized once. */ | |
| 1897 | 1900 | if( g.fTimeFormat==0 ){ |
| 1898 | 1901 | if( db_get_int("timeline-utc", 1) ){ |
| 1899 | - g.fTimeFormat = 1; | |
| 1902 | + g.fTimeFormat = 1000; | |
| 1900 | 1903 | }else{ |
| 1901 | - g.fTimeFormat = 2; | |
| 1904 | + g.fTimeFormat = -1000; | |
| 1902 | 1905 | } |
| 1903 | 1906 | } |
| 1904 | - if( g.fTimeFormat==1 ){ | |
| 1907 | + if( g.fTimeFormat>999 ) | |
| 1905 | 1908 | return ""; |
| 1906 | - }else{ | |
| 1909 | + if( g.fTimeFormat<-999 ) | |
| 1907 | 1910 | return ",'localtime'"; |
| 1911 | + if( !buf[0] ){ | |
| 1912 | + sprintf(buf, ",'%d minutes'", g.fTimeFormat); | |
| 1908 | 1913 | } |
| 1914 | + return buf; | |
| 1909 | 1915 | } |
| 1910 | 1916 | |
| 1911 | 1917 | |
| 1912 | 1918 | /* |
| 1913 | 1919 | ** COMMAND: test-timewarp-list |
| 1914 | 1920 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1885,29 +1885,35 @@ | |
| 1885 | print_timeline(&q, n, width, verboseFlag); |
| 1886 | db_finalize(&q); |
| 1887 | } |
| 1888 | |
| 1889 | /* |
| 1890 | ** Return one of two things: |
| 1891 | ** |
| 1892 | ** ",'localtime'" if the timeline-utc property is set to 0. |
| 1893 | ** |
| 1894 | ** "" (empty string) otherwise. |
| 1895 | */ |
| 1896 | const char *timeline_utc(){ |
| 1897 | if( g.fTimeFormat==0 ){ |
| 1898 | if( db_get_int("timeline-utc", 1) ){ |
| 1899 | g.fTimeFormat = 1; |
| 1900 | }else{ |
| 1901 | g.fTimeFormat = 2; |
| 1902 | } |
| 1903 | } |
| 1904 | if( g.fTimeFormat==1 ){ |
| 1905 | return ""; |
| 1906 | }else{ |
| 1907 | return ",'localtime'"; |
| 1908 | } |
| 1909 | } |
| 1910 | |
| 1911 | |
| 1912 | /* |
| 1913 | ** COMMAND: test-timewarp-list |
| 1914 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1885,29 +1885,35 @@ | |
| 1885 | print_timeline(&q, n, width, verboseFlag); |
| 1886 | db_finalize(&q); |
| 1887 | } |
| 1888 | |
| 1889 | /* |
| 1890 | ** Return one of three forms: |
| 1891 | ** |
| 1892 | ** ",'localtime'" when (server) localtime is desired |
| 1893 | ** |
| 1894 | ** "" when UTC is desired |
| 1895 | ** |
| 1896 | ** ",'??? minutes'" otherwise |
| 1897 | */ |
| 1898 | const char *timeline_utc(){ |
| 1899 | static char buf[16] = ""; /* only initialized once. */ |
| 1900 | if( g.fTimeFormat==0 ){ |
| 1901 | if( db_get_int("timeline-utc", 1) ){ |
| 1902 | g.fTimeFormat = 1000; |
| 1903 | }else{ |
| 1904 | g.fTimeFormat = -1000; |
| 1905 | } |
| 1906 | } |
| 1907 | if( g.fTimeFormat>999 ) |
| 1908 | return ""; |
| 1909 | if( g.fTimeFormat<-999 ) |
| 1910 | return ",'localtime'"; |
| 1911 | if( !buf[0] ){ |
| 1912 | sprintf(buf, ",'%d minutes'", g.fTimeFormat); |
| 1913 | } |
| 1914 | return buf; |
| 1915 | } |
| 1916 | |
| 1917 | |
| 1918 | /* |
| 1919 | ** COMMAND: test-timewarp-list |
| 1920 |