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: https://technical.swissmicros.com/decoders/dm42/
You can then copy/paste the listing and post it in "code" tags.
01 LBL "EPOCH"
02 3600
03 STO 00
04 1.01197
05 STO 01
06 86400
07 STO 02
08 SF 27
I wonder why, after a few calculation with Statistic and Matrix (resetting registers and statistic), the value 1.01197 wasn't stored in 01 apparently causing the misfunctioning.
Maybe I've too many programs loaded in DM42
I have installed the last firmware (3.20) just now. Ok.
After that, the Epoch program showed the message "Invalid data" and I had to store manually the three values (3600, 1.01197, 86400 in STO 00, 01, 02) as the program couldn't do it by itself.
Surely I'm wrong in something. But: where?
Salvo
EDIT: I think to have found the solution, putting the storage of registers first of the Menu routine, so 00, 01, 02 registers are now actually initialised.
the new code (updated in the first post):
The problem in your program as originally posted was that the initialization code, starting at line 18, was never executed, because it was unreachable.
The problem in your program as originally posted was that the initialization code, starting at line 18, was never executed, because it was unreachable.
hi Thomas,
yes, you are right.
The new version corrects this problem, but it is still not perfect, there are other errors maybe: I should avoid to print the default values in the registers 00 01 02 first of executing the routine A.
I made a couple of modifications to your program and it seems to be working okay:
- Displays the date and time on one line (requires a longer alpha than old 42s though).
- Loads from a global timezone variable the hour offset from UTC. (For instance, for me in America/Los_Angeles, it's -8 right now during standard time.) This helps give the correct epoch time even if your calculator isn't set to UTC time.
- Using YYYY-MM-DD date format.
- Did away with the constants stored in slots 00, 01, and 02 in favor of just using the constants inline.
I made a couple of modifications to your program and it seems to be working okay:
...
I'm trying in Free42 3.0.1.
I put 1 STO "TIMEZON" (Italy), then XEQ EPOCH and I get "Invalid data" for every three functions with my custom "date format"...
I'm not using YYYY-MM-DD but DD-MM-YYYY (normal here). Another improvement could be to permit using different modes for date.