Post Reply 
Unix/Linux Epoch Time Converter..
12-31-2017, 12:55 AM (This post was last modified: 12-31-2017 04:13 PM by Bill Duncan.)
Post: #1
Unix/Linux Epoch Time Converter..
Simple routine for unix epoch time conversions using hp-41 with time module (or 41CX et al). Useful if you're offline (on a train?) looking at log files..

Be sure to use a constant for reg 00 that is appropriate for your time zone and daylight savings time. (Seconds relative to GMT. Time zone given is Eastern Standard Time.)

Initialize constants by running start of program. Uses local labels in user mode.

"A" to get current epoch time.

Enter: Date [Enter] Time "B" to get epoch time for any given date/time.

The "C" routine will translate an epoch time to date/time values.

Test in user mode by pressing "A" then "C". This should get you the current date/time.

Cheers.

Code:

01 LBL "EPOCH"
02    -18000   STO 00
04    1.01197  STO 01
06    86400    STO 02
08    SF 27

09 LBL A
10   DATE 
11   TIME

12 LBL B
13   X<>Y
14   RCL 01
15   X<>Y
16   DDAYS
17   RCL 02
18   *
19   X<>Y
20   HR
21   3600
22   *
23   +
24   RCL 00
25   -
26 RTN

27 LBL C
28   RCL 00
29   +
30   ENTER
31   ENTER
32   RCL 02
33   /
34   INT
35   RCL 01
36   X<>Y
37   DATE+
38   CLA
39   ADATE
40   AVIEW
41   PSE
42   X<>Y
43   RCL 02
44   MOD
45   3600
46   /
47   HMS
48   CLA
49   ATIME
50   AVIEW
51 END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Unix/Linux Epoch Time Converter.. - Bill Duncan - 12-31-2017 12:55 AM



User(s) browsing this thread: 1 Guest(s)