Time setting on emonglcd

Hi all,

I get my time from the emonbase connected to the internet, but the time displayed is GMT and not GMT+2 where I am, time on computer is correct, also get the computer time from the internet, do you have to set it somewhere?

Thanks!

 

esawyja's picture

Re: Time setting on emonglcd

Anyone please?

logic's picture

Re: Time setting on emonglcd

I've had to do this for displaying BST so I added to the line (hour+1) but unfortunately I can't access my program just now to tell you exactly where I added this

I'm just replying to let you know that I will find out and post back hopefully within a day or two, incase you don't get any further responses.

Drsdre's picture

Re: Time setting on emonglcd

I've fixed the time issues temporarily by adding the following line in the Nanode RF sketch:

// UTC+1 for CET, +1 for summertime

now = now.get() + 3600 + 3600;

To be added right after DateTime now = RTC.now(); (after line 266 in Solar sketch).This solution requires a upload of a changed sketch at the beginning and end of summertime (with or without an additional 3600 seconds). I've did some investigation in using a timezone library (https://github.com/geneReeves/Arduino-TimeZone-Time) unfortunately this requires a re-implementation of the current time library.

Another option would be to determine the local timezone in emoncms3, which requires generating a date/time output which NanodeRF will parse instead of using the HTTP header time.

esawyja's picture

Re: Time setting on emonglcd

Thanks for the suggestions, let me try that

esawyja's picture

Re: Time setting on emonglcd

Nice, just did the change on the NanodeRF and that works a treat, we do not do the summer time change in South Africa, so I do not need to worry about that, thanks for the help!!

 DateTime now = RTC.now();
  // GMT+2?
now = now.get() + 3600 + 3600;
  if ((!now.hour()==0) && (!now.minute()==0)) {
    emonbase.hour = now.hour();    //don't send all zeros, happens when server failes to returns reponce to avoide GLCD getting mistakenly set to midnight
      emonbase.mins = now.minute();}
 
  //-----------------------------------------------------------------------------

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.