24:45?

I’ve a problem with the date() function.
After midnight the time should start counting at 0:00:01. Instead it continues counting until 24:59:59.
Why, or is this a Squirrel bug?

I can’t reproduce this: 16/01/2013 15:57:20: watchdog 23:57:19 16/01/2013 16:02:20: watchdog 00:02:19
Are you dead sure you aren’t adding the hour yourself somewhere – perhaps for timezone reasons?

Peter

this is what I’ve got:
17-1-2013 23:08:50: 20130117-23:08:47 WiFi Signal: -50 dBm
17-1-2013 23:19:37: 20130117-23:19:34 WiFi Signal: -50 dBm
17-1-2013 23:30:24: 20130117-23:30:21 WiFi Signal: -51 dBm
17-1-2013 23:41:11: 20130117-23:41:08 WiFi Signal: -51 dBm
17-1-2013 23:51:58: 20130117-23:51:55 WiFi Signal: -50 dBm
18-1-2013 00:02:45: 20130117-24:02:42 WiFi Signal: -50 dBm
18-1-2013 00:13:33: 20130117-24:13:29 WiFi Signal: -50 dBm
18-1-2013 00:24:20: 20130117-24:24:17 WiFi Signal: -49 dBm
18-1-2013 00:35:08: 20130117-24:35:04 WiFi Signal: -49 dBm
18-1-2013 00:45:55: 20130117-24:45:52 WiFi Signal: -50 dBm
18-1-2013 00:56:43: 20130117-24:56:39 WiFi Signal: -50 dBm
18-1-2013 01:07:29: 20130118-01:07:26 WiFi Signal: -50 dBm
18-1-2013 01:18:16: 20130118-01:18:13 WiFi Signal: -50 dBm

and this is the code to produce this:
`
function watchdog() {
imp.wakeup(10*60, watchdog);
local d = date();
server.log(format("%04d%02d%02d-%02d:%02d:%02d “, d.year, d.month+1, d.day, d.hour+1, d.min, d.sec) + " WiFi Signal: " + imp.rssi() + " dBm”);
}

// start sending something every ~10 minutes
watchdog();
`
I add hour+1 because my timezone is UTC + 1
I suppose this is wrong, but how to do this right?

I’m sure Peter will tell me there’s a better way, but change

local d = date();
to…

local d = date(time() + (60*60)); // get the date for an hour ahead

works for me. thanks