You are reading a single comment by @Fabio978 and its replies. Click here to read the full conversation.
  • The Puck has its own RTC, and it's "synced" everytime you upload something from your pc.

    Yes it does, but not by default. One would need to turn the option On in the web IDE settings.

    For some reason it set Puck time to 0:22 am, whereas it's 11:22 am in my time zone currently.
    Thus, I would not recommend to sync puck time with your browser time because Espruino has no knowledge about time zones. The missing time zone complicates development.

    My puck came to me with the time set close to Unix epoch ~ Jan 1970.

    For simplicity the code above assumes the Puck time zone is set to the local time (i.e. the local timezone is +00 hours). I did it with the setTime function. Here is how to get a value for the setTime using node.js or a browser REPL: (Date.now() / 1000) + tzHours*60*60.

    However, if you don't need the schedule feature, which relies on time, just remove lines 78-112.

  • Yes, my "dirty workaround" was to add +1 hour in the code, more or less like you suggest, while creating the Date object.
    Didn't think about using setTime to make it "permanent".

About

Avatar for Fabio978 @Fabio978 started