Epoch time conversion

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
User avatar
salvomic
Posts: 58
Joined: Sat Dec 30, 2017 9:09 am
Location: Ragusa, Sicily
Contact:

Epoch time conversion

Post by salvomic » Fri Feb 09, 2018 10:56 pm

hi,
I've modified a program of Bill Duncan intended for HP 41CX to get Epoch Time from a date and convert Date/Time into Epoch Time.
In this post on MoHPC you can read the thread.
If you are interested, the version for HP Prime is in the Program Library MoHPC.

I've modified the program for DM42 and Free42 (not HP 42s, as it miss the date, as we know), adding a custom Menu:
[Cur] → Current Epoch time [DT→E] → Date and Time to Epoch [E→DT] → Epoch to Date and Time
The program set 3600 as Time Zone variables (Europe, -1), you can set your time/zone (i.e. -18000 as in the original Bill's program).
The code:

Code: Select all

00 { 139-Byte Prgm }
01▸LBL "EPOCH"
02▸LBL H
03 "CUR"
04 KEY 1 XEQ A
05 "DT→E"
06 KEY 2 XEQ B
07 "E→DT"
08 KEY 3 XEQ C
09 KEY 9 GTO 99
10 MENU
11▸LBL 20
12 STOP
13 GTO 20
14▸LBL 99
15 CLMENU
16 EXITALL
17 RTN
18 3600
19 STO 00
20 1.01197
21 STO 01
22 86400
23 STO 02
24 SF 27
25▸LBL A
26 DATE
27 TIME
28▸LBL B
29 X<>Y
30 RCL 01
31 X<>Y
32 DDAYS
33 RCL 02
34 ×
35 X<>Y
36 →HR
37 3600
38 ×
39 +
40 RCL 00
41 -
42 RTN
43▸LBL C
44 RCL 00
45 +
46 ENTER
47 ENTER
48 RCL 02
49 ÷
50 IP
51 RCL 01
52 X<>Y
53 DATE+
54 CLA
55 ADATE
56 AVIEW
57 PSE
58 X<>Y
59 RCL 02
60 MOD
61 3600
62 ÷
63 →HMS
64 CLA
65 ATIME
66 AVIEW
67 END
You can convert it in ".raw" with the SwissMicros tool.
Enjoy!

Salvo
Attachments
20180209-23035508.jpg
20180209-23035508.jpg (32.18 KiB) Viewed 598 times
∫aL√0mic (IT9CLU) - DM42 (SN: 00881), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, HP 35s, WP34s :: Free42

Post Reply