Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread Tom Keffer
Not to be too terribly pedantic, but unix time does deal with leap seconds.
It's just that it deals with them using a discontinuity at midnight. The
result is that if you calculate the difference in unix epoch time between,
say, 23:55 and 00:10, it will *always* be 900 seconds, even if a leap
second was inserted in there. However, if you were to calculate the
difference in UTC, it would be 901 seconds if a leap second occurred.

99.9% of the time, this is what you want. It's a brilliant solution to a
difficult problem. The only problem is that every couple of years or so,
there will be a unit timestamp that is ambiguous. There will be two times
with the same timestamp.



On Fri, Nov 4, 2022 at 3:35 AM Greg Troxel  wrote:

>
> Phillip Fischer  writes:
>
> > Thank You! I am fairly new to the world of linux and learning new things
> > each day! I appreciate your time to answer my question.
>
> This is likely beyond what you care about, but note that the time values
> are the number of seconds since January 1, 1970 UTC **as if there were
> no leap seconds**.
>
> But with weather data every 15 minuts, that just means that occasionally
> those timestamps that differ from 900 will be 901 (or maybe in the
> future 899 seconds apart).  And, surely your weather station doesn't
> have leap second support, and your computer doesn't have a network
> connection.
>
>
> But seriously, I don't know how you are dealing with time, and probably
> you want to have a GPS receiver and run ntpd to sync the RPI's clock,
> and understand how that relates to the weather station's clock.
>
> You probably also want to run the RPI in UTC, and also the weather
> stations, so that there is no daylight savings time confusion.  weewx
> does not as far as I know support "operate in UTC but produce
> graphs/summaries in local time (meaning "today" as a 24h period,
> min/max, etc.)".  But you are just going to process the weewx.sdb
> elsewhere.
>
> I would also put a USB SSD or stick in the Pi and back up the weewx.sdb
> to that daily, in a way that doesn't overwrite the previous backups.
> And a UPS (even a Pi UPS with a battery, but beware of lithium batteries
> below freezing).
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/rmimt9757os.fsf%40s1.lexort.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEAJxSXy1dOwePPPWDVXuSoPGdfYVUx9R4kvk%2Bpm%3DDsSsg%40mail.gmail.com.


Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread Greg Troxel

Phillip Fischer  writes:

> Thank You! I am fairly new to the world of linux and learning new things 
> each day! I appreciate your time to answer my question.

This is likely beyond what you care about, but note that the time values
are the number of seconds since January 1, 1970 UTC **as if there were
no leap seconds**.

But with weather data every 15 minuts, that just means that occasionally
those timestamps that differ from 900 will be 901 (or maybe in the
future 899 seconds apart).  And, surely your weather station doesn't
have leap second support, and your computer doesn't have a network
connection.


But seriously, I don't know how you are dealing with time, and probably
you want to have a GPS receiver and run ntpd to sync the RPI's clock,
and understand how that relates to the weather station's clock.

You probably also want to run the RPI in UTC, and also the weather
stations, so that there is no daylight savings time confusion.  weewx
does not as far as I know support "operate in UTC but produce
graphs/summaries in local time (meaning "today" as a 24h period,
min/max, etc.)".  But you are just going to process the weewx.sdb
elsewhere.

I would also put a USB SSD or stick in the Pi and back up the weewx.sdb
to that daily, in a way that doesn't overwrite the previous backups.
And a UPS (even a Pi UPS with a battery, but beware of lithium batteries
below freezing).

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/rmimt9757os.fsf%40s1.lexort.com.


signature.asc
Description: PGP signature


Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread Phillip Fischer
Thank You! I am fairly new to the world of linux and learning new things 
each day! I appreciate your time to answer my question.

I've successfully converted the time and date stamps!

On Friday, 4 November 2022 at 11:33:50 UTC+2 peterq...@gmail.com wrote:

> A little more background. It's a unix epoch datetime. The number of 
> seconds since 1970 iirc. Google unix epoch.
>
> On Fri, Nov 4, 2022, 10:14 AM Glenn McKechnie  
> wrote:
>
>> unixepoch, epochtime, unixtime
>>
>> from a linux terminal...
>>
>> $ date -d now +'%s'
>> 1667553105
>>
>> $ date -d @1667553105
>> Fri 04 Nov 2022 20:11:45 AEDT
>>
>> man date
>>
>> within a mysql (mariadb)...
>> SELECT FROM_UNIXTIME(datetime, '%d-%m-%Y %H:%i') from archive WHERE
>> dateTime = 166734;
>>
>> there'll be something similar for sqlite
>>
>> On 04/11/2022, Phillip Fischer  wrote:
>> > I hope that someone would be able to point me in the right direction.
>> >
>> > I am aiming to use Weewx to log data from a weather station console of a
>> > station that is set up in a remote, out of the way area as part of my
>> > research. Due to an oversight in Station specs, I was given a station 
>> that
>> > will need to be downloaded every two weeks or else the data is 
>> overwritten,
>> >
>> > but getting to the site every two weeks is not going to happen!
>> >
>> > I've got the station running, connected to a Raspberry Pi Zero 2 and it 
>> is
>> > working and logging data without issue.
>> >
>> > It is easy to get into the .sdb and convert the data to .csv for export 
>> to
>> > analyse the data off site. There is no cell signal, wifi or any other 
>> way
>> > of connectivity at the site so the data needs to be physically 
>> downloaded.
>> >
>> > I am however a bit stumped as I cannot figure out in what format the 
>> date
>> > and time is stored as. It seems to be a serial number, but I am not sure
>> > how to convert that back to Date and Time.
>> >
>> > Does anyone perhaps have an idea on how to get the conversion done? I
>> > cannot find any explanation in the documentation about the units of the
>> > database values.
>> >
>> > dateTime
>> > 1667481600
>> > 1667481900
>> > 1667483700
>> > 1667484000
>> > 1667484300
>> > 1667484600
>> > 1667484900
>> > 1667485200
>> > 1667485500
>> > 1667485800
>> > 1667486100
>> >
>> > --
>> > 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+...@googlegroups.com.
>> > To view this discussion on the web visit
>> > 
>> https://groups.google.com/d/msgid/weewx-user/88e58150-35a5-4841-bea2-452d573b6f6dn%40googlegroups.com
>> .
>> >
>>
>>
>> -- 
>>
>>
>> Cheers
>>  Glenn
>>
>> rorpi - read only raspberry pi & various weewx addons
>> https://github.com/glennmckechnie
>>
>> -- 
>> 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+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/CAAraAzi8A02nYOkcwdDuz0ig_omcGZpWEKdTr%2B1fy9Oda1Pvog%40mail.gmail.com
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/9a6f9434-8477-46d1-a9c3-bd6197ba1990n%40googlegroups.com.


Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread p q
A little more background. It's a unix epoch datetime. The number of seconds
since 1970 iirc. Google unix epoch.

On Fri, Nov 4, 2022, 10:14 AM Glenn McKechnie 
wrote:

> unixepoch, epochtime, unixtime
>
> from a linux terminal...
>
> $ date -d now +'%s'
> 1667553105
>
> $ date -d @1667553105
> Fri 04 Nov 2022 20:11:45 AEDT
>
> man date
>
> within a mysql (mariadb)...
> SELECT FROM_UNIXTIME(datetime, '%d-%m-%Y %H:%i') from archive WHERE
> dateTime = 166734;
>
> there'll be something similar for sqlite
>
> On 04/11/2022, Phillip Fischer  wrote:
> > I hope that someone would be able to point me in the right direction.
> >
> > I am aiming to use Weewx to log data from a weather station console of a
> > station that is set up in a remote, out of the way area as part of my
> > research. Due to an oversight in Station specs, I was given a station
> that
> > will need to be downloaded every two weeks or else the data is
> overwritten,
> >
> > but getting to the site every two weeks is not going to happen!
> >
> > I've got the station running, connected to a Raspberry Pi Zero 2 and it
> is
> > working and logging data without issue.
> >
> > It is easy to get into the .sdb and convert the data to .csv for export
> to
> > analyse the data off site. There is no cell signal, wifi or any other way
> > of connectivity at the site so the data needs to be physically
> downloaded.
> >
> > I am however a bit stumped as I cannot figure out in what format the date
> > and time is stored as. It seems to be a serial number, but I am not sure
> > how to convert that back to Date and Time.
> >
> > Does anyone perhaps have an idea on how to get the conversion done? I
> > cannot find any explanation in the documentation about the units of the
> > database values.
> >
> > dateTime
> > 1667481600
> > 1667481900
> > 1667483700
> > 1667484000
> > 1667484300
> > 1667484600
> > 1667484900
> > 1667485200
> > 1667485500
> > 1667485800
> > 1667486100
> >
> > --
> > 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.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/weewx-user/88e58150-35a5-4841-bea2-452d573b6f6dn%40googlegroups.com
> .
> >
>
>
> --
>
>
> Cheers
>  Glenn
>
> rorpi - read only raspberry pi & various weewx addons
> https://github.com/glennmckechnie
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/CAAraAzi8A02nYOkcwdDuz0ig_omcGZpWEKdTr%2B1fy9Oda1Pvog%40mail.gmail.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAA1SM225DWn9ySN0QBtJ_2nF%2Ba8%2B55G-MTBwWj5Sj3k60OLezg%40mail.gmail.com.


Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread Glenn McKechnie
unixepoch, epochtime, unixtime

from a linux terminal...

$ date -d now +'%s'
1667553105

$ date -d @1667553105
Fri 04 Nov 2022 20:11:45 AEDT

man date

within a mysql (mariadb)...
SELECT FROM_UNIXTIME(datetime, '%d-%m-%Y %H:%i') from archive WHERE
dateTime = 166734;

there'll be something similar for sqlite

On 04/11/2022, Phillip Fischer  wrote:
> I hope that someone would be able to point me in the right direction.
>
> I am aiming to use Weewx to log data from a weather station console of a
> station that is set up in a remote, out of the way area as part of my
> research. Due to an oversight in Station specs, I was given a station that
> will need to be downloaded every two weeks or else the data is overwritten,
>
> but getting to the site every two weeks is not going to happen!
>
> I've got the station running, connected to a Raspberry Pi Zero 2 and it is
> working and logging data without issue.
>
> It is easy to get into the .sdb and convert the data to .csv for export to
> analyse the data off site. There is no cell signal, wifi or any other way
> of connectivity at the site so the data needs to be physically downloaded.
>
> I am however a bit stumped as I cannot figure out in what format the date
> and time is stored as. It seems to be a serial number, but I am not sure
> how to convert that back to Date and Time.
>
> Does anyone perhaps have an idea on how to get the conversion done? I
> cannot find any explanation in the documentation about the units of the
> database values.
>
> dateTime
> 1667481600
> 1667481900
> 1667483700
> 1667484000
> 1667484300
> 1667484600
> 1667484900
> 1667485200
> 1667485500
> 1667485800
> 1667486100
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/88e58150-35a5-4841-bea2-452d573b6f6dn%40googlegroups.com.
>


-- 


Cheers
 Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAAraAzi8A02nYOkcwdDuz0ig_omcGZpWEKdTr%2B1fy9Oda1Pvog%40mail.gmail.com.


Re: [weewx-user] Time and date format in Weewx database

2022-11-04 Thread Stephen Hocking
Hi Phillip,

It's in Unix Epoch time - this website will help you on how to convert it
to a sensible date & time.

https://www.epochconverter.com/#:~:text=The%20Unix%20epoch%20(or%20Unix,01T00%3A00%3A00Z)
.

On Fri, 4 Nov 2022 at 19:38, Phillip Fischer  wrote:

> I hope that someone would be able to point me in the right direction.
>
> I am aiming to use Weewx to log data from a weather station console of a
> station that is set up in a remote, out of the way area as part of my
> research. Due to an oversight in Station specs, I was given a station that
> will need to be downloaded every two weeks or else the data is overwritten,
> but getting to the site every two weeks is not going to happen!
>
> I've got the station running, connected to a Raspberry Pi Zero 2 and it is
> working and logging data without issue.
>
> It is easy to get into the .sdb and convert the data to .csv for export to
> analyse the data off site. There is no cell signal, wifi or any other way
> of connectivity at the site so the data needs to be physically downloaded.
>
> I am however a bit stumped as I cannot figure out in what format the date
> and time is stored as. It seems to be a serial number, but I am not sure
> how to convert that back to Date and Time.
>
> Does anyone perhaps have an idea on how to get the conversion done? I
> cannot find any explanation in the documentation about the units of the
> database values.
>
> dateTime
> 1667481600
> 1667481900
> 1667483700
> 1667484000
> 1667484300
> 1667484600
> 1667484900
> 1667485200
> 1667485500
> 1667485800
> 1667486100
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/88e58150-35a5-4841-bea2-452d573b6f6dn%40googlegroups.com
> 
> .
>


-- 

  "I and the public know
  what all schoolchildren learn
  Those to whom evil is done
  Do evil in return"W.H. Auden, "September 1, 1939"

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CA%2BxzKjBVSYm%2BqFuK%3Ds0mfbu2B0Y5gYmDeTOdWk2fyE_4dFi8Bw%40mail.gmail.com.