Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Allow the optional "Z" zulu-time designator even on 8-character punctuationless date-time values. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
3a3ce2fc65184cc089561ec1b6d7c07e |
| User & Date: | drh 2024-12-26 12:03:19.190 |
Context
|
2024-12-26
| ||
| 12:59 | The ymd= query parameter on /timeline understands the "Z" suffix on the date/time. check-in: 36eb0b4d28 user: drh tags: trunk | |
| 12:03 | Allow the optional "Z" zulu-time designator even on 8-character punctuationless date-time values. check-in: 3a3ce2fc65 user: drh tags: trunk | |
| 11:51 | Access the "Z" zulu-timezone designator on the end of punctuation-less datetime values. check-in: c464947f8d user: drh tags: trunk | |
Changes
Changes to src/name.c.
| ︙ | ︙ | |||
71 72 73 74 75 76 77 |
static const char aPunct[] = { 0, 0, '-', '-', ' ', ':', ':' };
int n = (int)strlen(zIn);
int i, j;
int addZulu = 0;
/* These forms are allowed:
**
| > | | | | < < | | | < < | > > | > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
static const char aPunct[] = { 0, 0, '-', '-', ' ', ':', ':' };
int n = (int)strlen(zIn);
int i, j;
int addZulu = 0;
/* These forms are allowed:
**
** 123456789 1234 123456789 123456789
** (1) YYYYMMDD => YYYY-MM-DD
** (2) YYYYMMDDHHMM => YYYY-MM-DD HH:MM
** (3) YYYYMMDDHHMMSS => YYYY-MM-DD HH:MM:SS
**
** An optional "Z" zulu timezone designator is allowed at the end.
*/
if( n>0 && (zIn[n-1]=='Z' || zIn[n-1]=='z') ){
n--;
addZulu = 1;
}
if( n!=8 && n!=12 && n!=14 ){
return 0;
}
/* Every character must be a digit */
for(i=0; fossil_isdigit(zIn[i]); i++){}
if( i!=n && (!addZulu || i!=n+1) ) return 0;
/* Expand the date */
for(i=j=0; i<n; i++){
if( i>=4 && (i%2)==0 ){
zEDate[j++] = aPunct[i/2];
}
zEDate[j++] = zIn[i];
}
if( addZulu ){
if( j==10 ){
memcpy(&zEDate[10]," 00:00", 6);
j += 6;
}
zEDate[j++] = 'Z';
}
zEDate[j] = 0;
/* Check for reasonable date values.
** Offset references:
** YYYY-MM-DD HH:MM:SS
** 0123456789 12345678
*/
|
| ︙ | ︙ |