nope.... (no problem in your code) - may be... (in interpretation of doc)...
On power on - py Pico shows 949363215.70712661743 seconds for ```getTime()``` (**Loading 2527 bytes from flash...** is form ```reset()``` and ```save()```).
Connected
Loading 2620 bytes from flash...
new Date().toString()
="Tue Feb 1 2000 00:00:18 GMT+0000"
getTime()
=949363232.21488475799
... after uploading, it shows more 'now': 1470274624.28208160400
1v86 Copyright 2016 G.Williams
echo(0);
=undefined
new Date().toString()
="Thu Aug 4 2016 01:42:42 GMT+0000"
getTime()
=1470274974.15566730499
```
Initially, there was no synchronization between time of your Browser/Web IDE and time of Espruino. Today, when uploading code (even empty editor pane), time is set to GMT+0000 (UTC) from the Browser/Web IDE has. Date() 'class'/object has always GMT+0000 / UTC. If Espruino connected to, for example, Web / http or a GPS, you may pull time from there.
You can set the time by taking the [ms] since "Thu, 01 Jan 1970 00:00:00 GMT" - in Browser Inspector Console with new Datae().getTime() - and divide them by 1000 to get seconds and feed those into setTime(seconds) in Espruino console. This will set your Espruino time to now in GMT+0000 / UTC.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
nope.... (no problem in your code) - may be... (in interpretation of doc)...
Initially, there was no synchronization between time of your Browser/Web IDE and time of Espruino. Today, when uploading code (even empty editor pane), time is set to GMT+0000 (UTC) from the Browser/Web IDE has. Date() 'class'/object has always GMT+0000 / UTC. If Espruino connected to, for example, Web / http or a GPS, you may pull time from there.
You can set the time by taking the [ms] since "Thu, 01 Jan 1970 00:00:00 GMT" - in Browser Inspector Console with
new Datae().getTime()
- and divide them by 1000 to get seconds and feed those intosetTime(seconds)
in Espruino console. This will set your Espruino time to now in GMT+0000 / UTC.This conversation 'fools' around with date and time formatting.