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

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

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

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,

[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

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

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

2017-10-11 Thread Don V Nielsen
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...@mailinglists.sqlite.org] > On Behalf

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

2017-10-11 Thread David Raymond
-300 seconds') < datetime('now'); 1 -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Don V Nielsen Sent: Wednesday, October 11, 2017 1:15 PM To: SQLite mailing list Subject: Re: [sqlite] Possible bug with strftime('%s') < strfti

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

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
17-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-11 > 10:04:43') + 0 > 0 > > > -Original Message- > From: David Raymond > Sent: Wednesday, October 11, 2017 9:10 AM >

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

2017-10-11 Thread David Raymond
nal Message- From: David Raymond Sent: Wednesday, October 11, 2017 9:10 AM To: sqlite-users@mailinglists.sqlite.org Subject: RE: [sqlite] Possible bug with strftime('%s') < strftime('%s') See https://sqlite.org/draft/datatype3.html in section 4.1, Sort Order. Any integer is less than any te

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

2017-10-11 Thread David Raymond
ice +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 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] Possible bug with strfti

[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