Changing timezone from UTC to US/Pacific

158 views
Skip to first unread message

Blake Garner

unread,
Oct 16, 2022, 7:34:30 PM10/16/22
to weewx-user
I want to change the timezone from UTC to Pacific time display in local time on my weewx website. From reading, it seems that weewx uses the system time and it's not configurable at the application. After changing my system timezone to US/Pacific I'm seeing this message spew in the logs. For now I flipped the timzone back until I have a better idea of what's going on. 

Oct 16 23:24:38 wx python3[2833293]: weewx[2833293] WARNING weewx.engine: Ignore historical record: {'dateTime': 1665970800, 'usUnits': 1, 'interval': 1, 'rxCheckPercent': 100.0, 'outTemp': 72.5, 'highOutTemp': 72.5, 'lowOutTemp': 72.3, 'rain': 0.0, 'rainRate': 0.0, 'barometer': 30.099, 'radiation': 526.0, 'wind_samples': 24.0, 'inTemp': 82.8, 'inHumidity': 37.0, 'outHumidity': 46.0, 'windSpeed': 3.0, 'windGust': 4.0, 'windGustDir': 315.0, 'windDir': 292.5, 'UV': 1.7, 'ET': 0.0, 'highRadiation': 526.0, 'highUV': 1.7, 'forecastRule': 44}

Host OS: Ubuntu 20.04 aarch64
weewx 4.8
Vantage Pro 2 wired

With times in the DB and on the host being out of sync is there a way to reconcile them? I considered just rebuilding some reports but figured I would ask here first. 

Thanks,
Blake





vince

unread,
Oct 16, 2022, 8:21:03 PM10/16/22
to weewx-user
I guess I'd start with asking to see what 'wee_device --info' returns....

As an example, mine looked like this last winter....

root@debian:~# /home/weewx/bin/wee_device --info
Using configuration file /home/weewx/weewx.conf
Using Vantage driver version 3.2.2 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:

[...]
    CONSOLE SETTINGS:
[...]
      Onboard time:                 2021-12-18 12:50:40
[...]

    CONSOLE STATION INFO:
[...]
      Use manual or auto DST?       AUTO
      DST setting:                  N/A
      Use GMT offset or zone code?  GMT_OFFSET
      Time zone code:               N/A
      GMT offset:                   -8.0 hours
      Temperature logging:          LAST
      Retransmit channel:           OFF (0)

bl...@netjibbing.com

unread,
Oct 16, 2022, 8:24:08 PM10/16/22
to weewx...@googlegroups.com, vince
Ok yeah the device didn’t get updated to the new timezone it seems.

wee_device --info
Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.2.3 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:
    
    CONSOLE TYPE:                   Vantage Pro2
    
   
    
    CONSOLE SETTINGS:
   
      Onboard time:                 2022-10-17 00:21:19
      
          
    CONSOLE STATION INFO:
      Latitude (onboard):           +47.4
      Longitude (onboard):          -122.2
      Use manual or auto DST?       AUTO
      DST setting:                  N/A
      Use GMT offset or zone code?  ZONE_CODE
      Time zone code:               4
      GMT offset:                   N/A
--
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/ABVraP4lXnU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/385f7be8-3425-49ca-b570-88f62bdd6e7cn%40googlegroups.com.

Greg Troxel

unread,
Oct 16, 2022, 8:32:29 PM10/16/22
to Blake Garner, weewx-user

Blake Garner <bl...@netjibbing.com> writes:

> I want to change the timezone from UTC to Pacific time display in local
> time on my weewx website. From reading, it seems that weewx uses the system
> time and it's not configurable at the application. After changing my system
> timezone to US/Pacific I'm seeing this message spew in the logs. For now I
> flipped the timzone back until I have a better idea of what's going on.
>
> Oct 16 23:24:38 wx python3[2833293]: *weewx[2833293] WARNING weewx.engine:
> Ignore historical record: {'dateTime': 1665970800, 'usUnits': 1,

$ TZ=UTC date -r 1665970800
Mon Oct 17 01:40:00 UTC 2022

So without knowing what the highest value is, hard to interpret.



I'm not totally clear on this, but I think what's happening is:

database is always in UTC

VP2 does not have a protocol that is always UTC and display localtime;
it fundamentally operates in local time

driver infers VP2 clock time as local time, in this case UTC

Yes, report generation follows timezone

My weewx machine (RPI3, NetBSD 9, with VP2) is set to EST5EDT.


So therefore I guess that your VP2 is running in UTC, even if it thinks
it is s PST8PDT which might mean that the data in the database is
correct, but

- the time on the console is 7 hours ahead (now)
- the daily high/low values are not for localtime midnight-midnight
- the data in the database is actually right.

- I have no idea what's going on with console DST settings.

To recover, I wonder if you need to somehow pause the console for 7h.
Or if just changing the time on the console as you flip the TZ is
enough.

Or if I'm wrong about labeling on database records being ok, and you
need to do surgery.

I'm sure someone has had this problem; definitely wait for better
advice, but this may give you things to think about and try to
understand, even if my guesses are a bit off.

Definitely back up your database right now, and also before you tried to
change the TZ the first time :-(
signature.asc

Blake Garner

unread,
Oct 16, 2022, 9:00:16 PM10/16/22
to weewx-user
OK I (backed up the db again) set the system timezone back to US/Pacific and then set the following down to 30 sec. 

[StdTimeSynch]
  clock_check = 30

I got these messages on the log shortly after service start.

Oct 16 17:52:49 wx python3[780]: weewx[780] INFO weewx.engine: Clock error is -24.57 seconds (positive is fast)
Oct 16 17:52:49 wx python3[780]: weewx[780] INFO weewx.drivers.vantage: Clock set to 2022-10-16 17:52:50 PDT (1665967970)

The " WARNING weewx.engine: Ignore historical record"  messages have now stopped on the log..

I ended up with some bad data in the db from what the reports show. 

vince

unread,
Oct 16, 2022, 10:57:26 PM10/16/22
to weewx-user
I'd probably approach it ala:
  • stop weewx and back up the db(s)
  • probably set debug=1 in weewx.conf to make logs more helpful
  • set the os system timezone as desired.  I think the magic incantation is 'sudo timedatectl set-timezone "America/Los_Angeles"  and if you run a full desktop there's a gui utility to do this as well.  One howto link is https://tecadmin.net/how-to-change-timezone-on-ubuntu-20-04/ - your syslog should show the date+time changed to your local timezone immediately.
  • I'd then set the console timezone manually at the Davis console.  The manual is at https://www.weathershack.com/products/davis/manuals/vantage-pro2-console-manual.pdf which is pretty clear
  • I'd personally shut the system down (full poweroff via 'sudo poweroff' or equivalent) and then power it back up
  • The os should set its clock via systemd (or ntp if you have that installed) and weewx should wait until it has sane time before starting.   The logs will tell you what's going on.
  • my recollection is weewx has no notion of timezone, but it's unclear to me what datestamps (if there are any) are in the records stored in the datalogger.  Given that the above should take only a minute or three to accomplish, I'd hope you won't lose any observations....but that's why we take the backups just.in.case.

Blake Garner

unread,
Oct 17, 2022, 1:47:05 AM10/17/22
to weewx-user
That seems like a nice safe approach for others who need to do the same thing.

I ended up doing something like this with a few side trips involved. 
Stop weewx
backup weeewx db
Setting the clock_check value really low
change timezone on the host
start weewx
check logs for errors
revert clock_check value
restart weewx.

Thanks for the suggestions!

Blake
Reply all
Reply to author
Forward
0 new messages