impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Jul 3, 2019 4:43:59 GMT -8
So I finally have logging to the SQL Db
Why is it storing items as UTC date time stamp ? Not much use really - I am in UTC +10 and I would need to convert date / times throughout anything I am planning to do.... Its updating to Weather Underground with a correct time by the looks of it...
Currently Timestamps in the database are showing through PHPAdmin as 2019-07-03 12:30:48 yet my raspberry PI is showing correct date and time of 2019-07-03 22:30:48 - so to me it looks like its using UTC ?
I just wanted to install a solution that worked.... but so far I have had to workthrough issues of getting SQL installed, getting passwords set on Sql, Getting PHP to work.... Manual says it will update weather underground every 5 minutes but its doing it every 30 seconds, pressure might be updating incorrectly, email header shows title of XXXXYYYY and had to solve that - as I am not using WeatherSTEM the doco never told me I needed to update those fields as they are shared elsewhere... Nothing I have seen to clear data out yet - had to write code to clear log files, and as I don't want the SQL DB to fill, more code to keep only limited data... which then highlighted the issue of date / times...
This is not easy ! And I was not wanting to write it all myself!
|
|
|
Post by SDL on Jul 3, 2019 6:15:54 GMT -8
Storing dates and times as UTC only has proven to be the best way. When you are looking at multiple time zones for display and daylight savings time, etc, the fixed UTC time is the way to go. When displaying time or setting up queries, converting times from and to UTC is pretty easy with tons of support from Python libraries. It is updating Weather Underground every 30 seconds, the fix to this is where: For that fix: forum.switchdoc.com/thread/959/skyweather-weather-undergroundEverybody wants something different in logging for sure, so there is some custom stuff you will have to do. Shouldn't have had to fight the MySQL install however. BP
|
|
impactoz
Full Member
Posts: 142
Raspberry Pi: Yes
|
Post by impactoz on Jul 3, 2019 15:00:16 GMT -8
That's fine - easily fixed at my end.... I just did not know if it was a bug or an architectural decision. I will fork away now from your great starting point and customise what I need...
Your hardware is fantastic - I love it.... and of course everyone does want something different, like I have already included an ultrasonic measurement device and my own code to measure the level of the water tank to ensure I am collecting and knowing how full the water tank is, them weekly email I produce, wants to know about the amount of rainfall that occurred this week for the stats - hence why it is so much easier that the SQL is storing with local time...
Again - no big deal, I will code what I need now from your starting point of the software....
I agree storing as UTC is the right thing to do for multi site, multi timezone, variable data - but given that this is a single solution, your software is designed really for a single weather station, not really looking at things across multiple timezones - then maybe, just maybe, the storage of data for the local time zone is more adapt.
All good
Thanks
|
|
|
Post by doxidad on Jul 4, 2019 8:14:41 GMT -8
Check out the MariaDB (MySql) documentation site. You can set the timezone for the database on how timestamps are stored.
|
|