OLD | NEW |
1 # 2003 October 31 | 1 # 2003 October 31 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 datetest 2.48 {datetime('2003-10-22 12:24','9.4 second')} {2003-10-22 12:24:09} | 144 datetest 2.48 {datetime('2003-10-22 12:24','9.4 second')} {2003-10-22 12:24:09} |
145 datetest 2.49 {datetime('2003-10-22 12:24','0000 second')} {2003-10-22 12:24:00} | 145 datetest 2.49 {datetime('2003-10-22 12:24','0000 second')} {2003-10-22 12:24:00} |
146 datetest 2.50 {datetime('2003-10-22 12:24','0001 second')} {2003-10-22 12:24:01} | 146 datetest 2.50 {datetime('2003-10-22 12:24','0001 second')} {2003-10-22 12:24:01} |
147 datetest 2.51 {datetime('2003-10-22 12:24','nonsense')} NULL | 147 datetest 2.51 {datetime('2003-10-22 12:24','nonsense')} NULL |
148 | 148 |
149 datetest 3.1 {strftime('%d','2003-10-31 12:34:56.432')} 31 | 149 datetest 3.1 {strftime('%d','2003-10-31 12:34:56.432')} 31 |
150 datetest 3.2.1 {strftime('pre%fpost','2003-10-31 12:34:56.432')} pre56.432post | 150 datetest 3.2.1 {strftime('pre%fpost','2003-10-31 12:34:56.432')} pre56.432post |
151 datetest 3.2.2 {strftime('%f','2003-10-31 12:34:59.9999999')} 59.999 | 151 datetest 3.2.2 {strftime('%f','2003-10-31 12:34:59.9999999')} 59.999 |
152 datetest 3.3 {strftime('%H','2003-10-31 12:34:56.432')} 12 | 152 datetest 3.3 {strftime('%H','2003-10-31 12:34:56.432')} 12 |
153 datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 | 153 datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 |
154 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.02426426 | 154 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.024264259 |
155 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 | 155 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 |
156 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 | 156 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 |
157 datetest 3.8.1 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 | 157 datetest 3.8.1 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 |
158 datetest 3.8.2 {strftime('%s','2038-01-19 03:14:07')} 2147483647 | 158 datetest 3.8.2 {strftime('%s','2038-01-19 03:14:07')} 2147483647 |
159 datetest 3.8.3 {strftime('%s','2038-01-19 03:14:08')} 2147483648 | 159 datetest 3.8.3 {strftime('%s','2038-01-19 03:14:08')} 2147483648 |
160 datetest 3.8.4 {strftime('%s','2201-04-09 12:00:00')} 7298164800 | 160 datetest 3.8.4 {strftime('%s','2201-04-09 12:00:00')} 7298164800 |
161 datetest 3.8.5 {strftime('%s','9999-12-31 23:59:59')} 253402300799 | 161 datetest 3.8.5 {strftime('%s','9999-12-31 23:59:59')} 253402300799 |
162 datetest 3.8.6 {strftime('%s','1969-12-31 23:59:59')} -1 | 162 datetest 3.8.6 {strftime('%s','1969-12-31 23:59:59')} -1 |
163 datetest 3.8.7 {strftime('%s','1901-12-13 20:45:52')} -2147483648 | 163 datetest 3.8.7 {strftime('%s','1901-12-13 20:45:52')} -2147483648 |
164 datetest 3.8.8 {strftime('%s','1901-12-13 20:45:51')} -2147483649 | 164 datetest 3.8.8 {strftime('%s','1901-12-13 20:45:51')} -2147483649 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 for {set i 0} {$i<=255} {incr i} { | 521 for {set i 0} {$i<=255} {incr i} { |
522 db close | 522 db close |
523 hexio_write test.db 2047 [format %02x $i] | 523 hexio_write test.db 2047 [format %02x $i] |
524 sqlite3 db test.db | 524 sqlite3 db test.db |
525 do_test date-14.2.$i { | 525 do_test date-14.2.$i { |
526 set date [db one {SELECT datetime(x) FROM t1}] | 526 set date [db one {SELECT datetime(x) FROM t1}] |
527 expr {$date eq "2008-06-12 00:00:00" || $date eq "2008-06-11 23:59:59"} | 527 expr {$date eq "2008-06-12 00:00:00" || $date eq "2008-06-11 23:59:59"} |
528 } {1} | 528 } {1} |
529 } | 529 } |
530 } | 530 } |
| 531 |
| 532 # Verify that multiple calls to date functions with 'now' return the |
| 533 # same answer. |
| 534 # |
| 535 # EVIDENCE-OF: R-34818-13664 The 'now' argument to date and time |
| 536 # functions always returns exactly the same value for multiple |
| 537 # invocations within the same sqlite3_step() call. |
| 538 # |
| 539 proc sleeper {} {after 100} |
| 540 do_test date-15.1 { |
| 541 db func sleeper sleeper |
| 542 db eval { |
| 543 SELECT c - a FROM (SELECT julianday('now') AS a, |
| 544 sleeper(), julianday('now') AS c); |
| 545 } |
| 546 } {0.0} |
| 547 do_test date-15.2 { |
| 548 db eval { |
| 549 SELECT a==b FROM (SELECT current_timestamp AS a, |
| 550 sleeper(), current_timestamp AS b); |
| 551 } |
| 552 } {1} |
| 553 |
531 finish_test | 554 finish_test |
OLD | NEW |