I've finally gotten this to do it again, and actually had time to look at it in detail.
The program is started automatically at boot by /etc/rc.local
At startup time, the program now saves in globals:
AppStrtTime = time();
AppStrtBasetime = $^T;
UnixUpAtAppStrt = Unix::Uptime->uptime();
The next afternoon I query the program and get:
System uptime: (81700) 0d 22:41:40
Program uptime: (82550) 0d 22:55:50
UnixUpAtAppStrt: 27
AppStrtTime: 1684095442
AppStartBasetime: 1684095441
time() now: 1684177991
^T now: 1684095441
Armed with these numbers, reality check:
UnixUpAtAppStrt = 27 -- sounds reasonable - boot to Perl app startup took half minute
AppStrtTime follows within a second of AppStrtBasetime -- seems right as ^T was set when the app started, which would be before the code in the app actually started to execute and perform the time() call
^T now -- matches the ^T from startup, it has not changed
With AppStrtTime time, and assuming UnixUpAtAppStrt was correct, the actual system startup time was:
1684095442 - 27 = 1684095415
Subtracting that from time now():
1684177991 - 1684095415 = 82576
yet:
Unix::Uptime->uptime() = 81700
WRONG! This should be 82576.
If it was only a few seconds off, I wouldn't have even noticed, but it's off by 14+ mins in under 24 hours!
Maybe some day I'll have a look at Unix::Uptime, but it may be a while - like years.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.