Re: psutil.boot_time() ... doesn't ?

2019-11-08 Thread R.Wieser
Dennis, > However -- manually changing date/time is not going to illustrate this. > ANY change made to date/time will reflect a change in UTC time. It turns out that the get_uptime() does /not/ calculate the boottime from the current clock minus the uptime. Its a seconds-since-epoch (absolute!)

Re: psutil.boot_time() ... doesn't ?

2019-11-08 Thread R.Wieser
Dennis, > Well... If it is the last file written during shutdown, it would be > the "last file system modification time" Yep ... up until the next hours cronjob overwriting it ... Currently I've got a (very) small init.d shellscript which copies the contents of that file into another one - whi

Re: psutil.boot_time() ... doesn't ?

2019-11-07 Thread Chris Angelico
On Fri, Nov 8, 2019 at 1:24 AM R.Wieser wrote: > > Chris, > > > Yes, but even if it's not recorded as a timestamp but as an > > uptime counter, that counter can be referenced against the > > current time in UTC. > > Absolutily. Though the keyword here is "can". My "could easily imagine" > consi

Re: psutil.boot_time() ... doesn't ?

2019-11-07 Thread R.Wieser
Chris, > Yes, but even if it's not recorded as a timestamp but as an > uptime counter, that counter can be referenced against the > current time in UTC. Absolutily. Though the keyword here is "can". My "could easily imagine" considers the other possibility. I guess I should sit down sometime

Re: psutil.boot_time() ... doesn't ?

2019-11-07 Thread R.Wieser
Dennis, > Which is probably... last file system modification time Nope. Its from a file it saves at shutdown, and which gets updated once an hour (I also thought of that one, but the once-an-hour update threw a wrench into it). > There is no way for a freshly booted system to differentiate be

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Luciano Ramalho
On Wed, Nov 6, 2019 at 7:54 PM Terry Reedy wrote: > I don't know how much Linux is customized for RP, but last I knew, > Python on RP is MicroPython, not CPython. So I expect OS-related > functions to not necessarily match Linux on a desktop. The default OS on all Raspberry Pi models is Raspbian

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Eryk Sun
On 11/6/19, Chris Angelico wrote: > > Yes, but even if it's not recorded as a timestamp but as an uptime > counter, that counter can be referenced against the current time in > UTC. A DST switch affects the displayed time, but not the internal > definition of "current time" (at least, not on Linux

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread MRAB
On 2019-11-06 22:53, Terry Reedy wrote: On 11/6/2019 3:09 PM, R.Wieser wrote: Dennis, Depends upon the OS... My apologies, its Linux (as on a Raspberry Pi). I don't know how much Linux is customized for RP, but last I knew, Python on RP is MicroPython, not CPython. So I expect OS-related f

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Chris Angelico
On Thu, Nov 7, 2019 at 9:55 AM Terry Reedy wrote: > > On 11/6/2019 3:09 PM, R.Wieser wrote: > > Dennis, > >> Depends upon the OS... > > > > My apologies, its Linux (as on a Raspberry Pi). > > I don't know how much Linux is customized for RP, but last I knew, > Python on RP is MicroPython, not CPyt

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Terry Reedy
On 11/6/2019 3:09 PM, R.Wieser wrote: Dennis, Depends upon the OS... My apologies, its Linux (as on a Raspberry Pi). I don't know how much Linux is customized for RP, but last I knew, Python on RP is MicroPython, not CPython. So I expect OS-related functions to not necessarily match Linux

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Chris Angelico
On Thu, Nov 7, 2019 at 7:31 AM R.Wieser wrote: > > Chris, > > > I don't think boot time would be affected by a DST switch, though. > > It should be recorded in UTC. > > The point is, it /isn't/ a recorded constant (at least not on my machine). > Its just dragged around with the clocks current time

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Chris Angelico
On Thu, Nov 7, 2019 at 7:21 AM R.Wieser wrote: > > Chris > > > That's possibly because you're looking at psutil, which is a third > > party package. Here's its documentation: > > My info came frome here: > https://www.programcreek.com/python/example/53873/psutil.boot_time > > Looking at example 1

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread R.Wieser
Chris, > I don't think boot time would be affected by a DST switch, though. > It should be recorded in UTC. The point is, it /isn't/ a recorded constant (at least not on my machine). Its just dragged around with the clocks current time (as in: current time minus uptime). And as such I could e

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread R.Wieser
Chris > That's possibly because you're looking at psutil, which is a third > party package. Here's its documentation: My info came frome here: https://www.programcreek.com/python/example/53873/psutil.boot_time Looking at example 1 it looks the be the same. > But I don't know what its definition

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Chris Angelico
On Thu, Nov 7, 2019 at 7:16 AM R.Wieser wrote: > But granted, on a Raspberry thats a bit of a problem. On the other hand, > just dragging the "last boot time" around by whatever time you now set feels > like fakery. > > Oh man, I can already imagine a CSI plot where someone tries to use as linux

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread R.Wieser
Dennis, > Depends upon the OS... My apologies, its Linux (as on a Raspberry Pi). > You can easily look at the code used by psutil :-) I somehow assumed that those where build-in into the language itself. I'll have to take a peek at what else is available there too. > I read somewhere that the

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Chris Angelico
On Thu, Nov 7, 2019 at 6:11 AM R.Wieser wrote: > > I also tried to google "python BOOT_TIME", but got nowhere (the latter parts > casing was ignored). Hence me posting here. > That's possibly because you're looking at psutil, which is a third party package. Here's its documentation: https://psu

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread R.Wieser
Maxime, > You may want to read PEP 418 which nicely summaries the > different clock available on each platform and their limitations. You mean the CLOCK_REALTIME and CLOCK_MONOTONIC ones ? Yeah, that was what I was looking at :-) > It looks like CLOCK_BOOTTIME is what you want but it is only >

Re: psutil.boot_time() ... doesn't ?

2019-11-06 Thread Maxime S
Hello, You may want to read PEP 418 which nicely summaries the different clock available on each platform and their limitations. It looks like CLOCK_BOOTTIME is what you want but it is only available on Linux. Regards, Maxime. Le mer. 6 nov. 2019 à 18:23, R.Wieser a écrit : > Hello all, > >

psutil.boot_time() ... doesn't ?

2019-11-06 Thread R.Wieser
Hello all, I was doing a "lets print some time-related data", and also diaplayed the result of "psutil.boot_time()". Somewhere while doing that I saw that my clock was off, so I used the "date" command to rectify it. The thing is, after that the result of "psutil.boot_time()" was changed - and t