localtimestamp returns local time WITHOUT timezone-offset
Basically: It returns UTC
You are in China. You are 8 hours before UTC.
Try current_timestamp or NOW()
OK, but it still has nothing to do with sqldb.
Do a Writeln of "Now"
and do a Writeln of "SELECT LOCALTIMESTAMP(0)"
and compare
2022-05-17 21:34:56 Call TestQueryClick RecordCount=0 //21:34:56<21:35:08 it's rightNo it's not. 21:34:56 to 21:35:08 is 12 seconds difference, not the 5 you are looking for.
TDateTime: 8 bytes, extended: 10 bytes
Local time: 2022-05-08 10:23:20.9
UTC: 2022-05-08 09:23:20.9
Unix secs: 1652005400
POSIX secs: 1652001800.93093 (2022-05-08 09:23:20.9)
Something else: Are you really checking for a difference of smaller than 5 seconds?i'm sorry,I'm change the 5 to 0 just to make the comparison easier,Sorry to confuse you.
Finally, I admit to being extremely uncomfortable with a query which compares timestamps stored on the server with a value injected from a client system... or vice-versa. My preference is for the server to never attempt to apply DST corrections, and for tables to contain both server- and client-generated timestamps with the appropriate ones selected according to the requirements of an operation.
Finally, I admit to being extremely uncomfortable with a query which compares timestamps stored on the server with a value injected from a client system... or vice-versa. My preference is for the server to never attempt to apply DST corrections, and for tables to contain both server- and client-generated timestamps with the appropriate ones selected according to the requirements of an operation.
Great advice,thank you.