-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
165 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ISO week date specifiers. | ||
# https://sqlite.org/forum/forumpost/73d99e4497e8e6a7 | ||
--- sqlite3.c.orig | ||
+++ sqlite3.c | ||
@@ -1373,6 +1373,29 @@ static void strftimeFunc( | ||
sqlite3_str_appendchar(&sRes, 1, c); | ||
break; | ||
} | ||
+ case 'V': /* Fall thru */ | ||
+ case 'G': { | ||
+ DateTime y = x; | ||
+ computeJD(&y); | ||
+ y.validYMD = 0; | ||
+ /* Adjust date to Thursday this week: | ||
+ The number in parentheses is 0 for Monday, 3 for Thursday */ | ||
+ y.iJD += (3 - (((y.iJD+43200000)/86400000) % 7))*86400000; | ||
+ computeYMD(&y); | ||
+ if( cf=='G' ){ | ||
+ sqlite3_str_appendf(&sRes,"%04d",y.Y); | ||
+ }else{ | ||
+ int nDay; /* Number of days since 1st day of year */ | ||
+ i64 tJD = y.iJD; | ||
+ y.validJD = 0; | ||
+ y.M = 1; | ||
+ y.D = 1; | ||
+ computeJD(&y); | ||
+ nDay = (int)((tJD-y.iJD+43200000)/86400000); | ||
+ sqlite3_str_appendf(&sRes,"%02d",nDay/7+1); | ||
+ } | ||
+ break; | ||
+ } | ||
case 'Y': { | ||
sqlite3_str_appendf(&sRes,"%04d",x.Y); | ||
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Set UTC timezone, compute local offset. | ||
--- sqlite3.c.orig | ||
+++ sqlite3.c | ||
@@ -340,6 +340,7 @@ static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ | ||
p->iJD = sqlite3StmtCurrentTime(context); | ||
if( p->iJD>0 ){ | ||
p->validJD = 1; | ||
+ p->tzSet = 1; | ||
return 0; | ||
}else{ | ||
return 1; | ||
@@ -355,6 +356,7 @@ static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ | ||
static void setRawDateNumber(DateTime *p, double r){ | ||
p->s = r; | ||
p->rawS = 1; | ||
+ p->tzSet = 1; | ||
if( r>=0.0 && r<5373484.5 ){ | ||
p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5); | ||
p->validJD = 1; | ||
@@ -731,7 +733,16 @@ static int parseModifier( | ||
** show local time. | ||
*/ | ||
if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ | ||
- rc = toLocaltime(p, pCtx); | ||
+ if( p->tzSet!=0 || p->tz==0 ) { | ||
+ rc = toLocaltime(p, pCtx); | ||
+ i64 iOrigJD = p->iJD; | ||
+ p->tzSet = 0; | ||
+ computeJD(p); | ||
+ p->tz = (p->iJD-iOrigJD)/60000; | ||
+ if( abs(p->tz)>= 900 ) p->tz = 0; | ||
+ } else { | ||
+ rc = 0; | ||
+ } | ||
} | ||
break; | ||
} | ||
@@ -781,6 +792,7 @@ static int parseModifier( | ||
p->validJD = 1; | ||
p->tzSet = 1; | ||
} | ||
+ p->tz = 0; | ||
rc = SQLITE_OK; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
Git LFS file not shown