PDA

View Full Version : DT_DateTimeSubSeconds breaking in late December



harsh
27-01-2017, 20:50
Here's a fun one::D

Watch what happens to the result when the day goes from December 29th to December 30th.

I also tried adding -1 second with a different result.

----8<-------------------------------------------------------
Dim date, time As String
'---Load Console and DT Modules
Uses "Console"
Uses "dt"

'--- These are the strings
date="12-29-2016"
time="15:38:44"
PrintL DT_DateTimeSubSeconds(date,time,1) '--- subtract a second

'--- Advance the date
date="12-30-2016"
PrintL DT_DateTimeSubSeconds(date,time,1) '--- whoopsie!
PrintL DT_DateTimeAddSeconds(date,time,-1) '--- add (-1) second -- oof!

WaitKey
------------------------------------------------------->8----

Petr Schreiber
30-01-2017, 10:44
Oh noes,

thanks for reporting this, this is a bug indeed!


Petr

harsh
01-02-2017, 00:25
I was confounded by the differing results between the DT_DateTimeAddSeconds and DT_DateTimeSubSeconds functions. I assumed they would give identical results (right or wrong) as they do when the bug isn't in play.