Interesting. On your Pi command line, type this: python import time time.localtime( time.time() )
What does it return? Does it look accurate? For example mine is accurate: time.struct_time(tm_year=2018, tm_mon=9, tm_mday=8, tm_hour=10, tm_min=4, tm_sec=42, tm_wday=5, tm_yday=251, tm_isdst=1) Then try this in the Python window: import calendar moment_js_stop_struct = time.localtime( time.time() ) moment_js_utc_offset = (calendar.timegm(moment_js_stop_struct) - calendar.timegm(time.gmtime(time.mktime(moment_js_stop_struct))))/60/60 print moment_js_utc_offset What does it return? It should return 5.5, but this could be the problem. Maybe there is a rounding going on to 5. Mine returns "-4" On Saturday, September 8, 2018 at 10:02:13 AM UTC-4, Praveen Chandrasekaran wrote: > > Hi Pat, > > The offset in page source there is 5. It should have been 5.5. Here is > result of date and date -u on my pi > > READ WRITE : root@raspberrypi:/var/tmp# date > Sat 8 Sep 19:28:58 IST 2018 > READ WRITE : root@raspberrypi:/var/tmp# date -u > Sat 8 Sep 13:59:11 UTC 2018 > > As per this timezone is fine on my pi and can clearly see offset should > have been 5.5 hours. > > Regards, > Praveen > > On Sat, 8 Sep 2018 at 19:25, Pat <p...@obrienphoto.net <javascript:>> > wrote: > > Does it have to do with a locale / timezone? > > Here is the code. All it is doing is taking the timestamp from MQTT and > converting it to your UTC offset. The UTC offset is retrieved from your OS > settings. > > updated = moment.unix(epoch).utcOffset($moment_js_utc_offset).format("MMMM > D, YYYY, h:mm:ss a"); // requires moment.js > > and here is where $moment_js_utc_offset is retrieved from. > > bin/user/belchertown.py > > # Setup UTC offset hours for moment.js in index.html > moment_js_stop_struct = time.localtime( time.time() ) > moment_js_utc_offset = (calendar.timegm(moment_js_stop_struct) - calendar > .timegm(time.gmtime(time.mktime(moment_js_stop_struct))))/60/60 > > View source of your page and look for updated = moment.unix(epoch). > utcOffset. What does it show for the offset in ()? Is it right? > > ... -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.