Filed issue. Will file for other issues also now. On Sat, 8 Sep 2018 at 19:46, Praveen Chandrasekaran <[email protected]> wrote:
> Never examined that so closely. 19800/60 is still in minutes so no > rounding issues there. It is the additional divide by 60 that causes the > issue. > > On Sat, 8 Sep 2018 at 19:45, Pat <[email protected]> wrote: > >> Are your highcharts from Gary working with the right timezone? >> >> This UTC offset code is the same that's used in his code >> <https://github.com/gjr80/weewx-highcharts/blob/master/bin/user/highchartsSearchX.py#L214-L216> >> with an additional /60 for JavaScript's requirements. . >> >> On Saturday, September 8, 2018 at 10:13:14 AM UTC-4, Praveen >> Chandrasekaran wrote: >>> >>> Hi Pat, >>> >>> You are right. >>> >>> 19800/60/60 gets rounded off to 5 instead of 5.5. So another issue to >>> fix :) >>> >>> Regards, >>> Praveen >>> >>> On Sat, 8 Sep 2018 at 19:36, Pat <[email protected]> wrote: >>> >>> 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 <[email protected]> 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. >>> >>> ... >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "weewx-user" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/weewx-user/GSrKZEiPqsc/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
