Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-13 Thread Wout Mertens
I feel safer now :) On Fri, Oct 13, 2017, 12:57 PM Rowan Worth wrote: > In that case you would be well advised to use a monotonic clock source, > rather than a "date-generating" clock. In linux this is the difference > between providing CLOCK_MONOTONIC or CLOCK_REALTIME as the first argument > t

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-13 Thread Rowan Worth
In that case you would be well advised to use a monotonic clock source, rather than a "date-generating" clock. In linux this is the difference between providing CLOCK_MONOTONIC or CLOCK_REALTIME as the first argument to clock_gettime(). But any API you might use to set a trigger for 2 seconds into

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-13 Thread R Smith
On 2017/10/13 12:42 PM, Wout Mertens wrote: Thank you, very interesting! The leap second behavior is slightly worrying, basically anything time-based (animations etc) will take a second longer? What if you want an engine burn to last 2 seconds, set a trigger for 2 seconds from now, and then it'

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-13 Thread Wout Mertens
Thank you, very interesting! The leap second behavior is slightly worrying, basically anything time-based (animations etc) will take a second longer? What if you want an engine burn to last 2 seconds, set a trigger for 2 seconds from now, and then it's burning 50% longer? On Thu, Oct 12, 2017, 3:

[sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-12 Thread Stephan Buchert
This has not much to do with the original question, but as physicist I cannot resist: National institutes (NIST in the US, NPL in the UK, PTB in Germany, to name just a few) provide reference times in UTC, which are distributed nowadays also via the internet, e.g. the NTP protocol. Therefore clock

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread Keith Medcalf
>Better yet, either one of the datetime() or julianday() functions >(with the same one used consistently in all places) will work best >for comparison since the output for either one sorts correctly >against itself. strftime() should be saved for display formatting. Only for a timestring with a c

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread Don V Nielsen
1 > 00:00:20'); > 0 > > sqlite> select julianday('1970-01-01 00:01:40') < julianday('1970-01-01 > 00:00:20'); > 0 > > sqlite> select datetime('now', '+300 seconds') < datetime('now'); > 0 > > sqlite> select datet

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread David Raymond
; 0 sqlite> select datetime('now', '+300 seconds') < datetime('now'); 0 sqlite> select datetime('now', '-300 seconds') < datetime('now'); 1 -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglis

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread Tim Streater
On 11 Oct 2017, at 18:53, R Smith wrote: > Yes. When you concatenate/add a string and integer together some SQL > engines will try to give a sensible result, so that '5' + 3 will yield 8 > because 3 is INT and it reckons that '5' probably meant 5 since it is > added to another INT and the 5 do

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread R Smith
On 2017/10/11 7:15 PM, Don V Nielsen wrote: So strftime always returns TEXT. Correct? Yes. The "str" in "strftime" means "string" which is text output. You can read the name "strftime" as "string-formatted-time value". It was the application of +300 to that result that changed the type to

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread Don V Nielsen
n it into an integer as well. > > sqlite> select strftime('%s', '2017-10-11 10:04:43') + 300 < > strftime('%s','2017-10-11 10:04:43') + 0; > strftime('%s', '2017-10-11 10:04:43') + 300 < strftime('%s','2017-10-

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread David Raymond
;,'2017-10-11 10:04:43') + 0; strftime('%s', '2017-10-11 10:04:43') + 300 < strftime('%s','2017-10-11 10:04:43') + 0 0 -Original Message- From: David Raymond Sent: Wednesday, October 11, 2017 9:10 AM To: sqlite-users@mailinglists.sqlite

Re: [sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread David Raymond
ngineer | TomTom | Lebanon, NH, United States e-mail: david.raym...@tomtom.com  | office +1 603 306 8498 | www.tomtom.com -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Eric Bollengier Sent: Wednesday, October 11, 2017 8:55 A

[sqlite] Possible bug with strftime('%s') < strftime('%s')

2017-10-11 Thread Eric Bollengier
Hello, I have noticed a problem in SQLite 3.20.1 for a simple operation based on strftime('%s'). With SQLite 3.20.1 and 3.6.18 sqlite> select (strftime('%s', '2017-10-11 10:04:43') + 300) <  strftime('%s', '2017-10-11 10:04:43'); 1 If I use the CAST operator on the second member, it works sql