time and date functions

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
WLVA
Posts: 7
Joined: Sat Jul 11, 2020 5:05 pm

time and date functions

Post by WLVA »

I have had my DM42 (S/N 05503) for a couple of weeks. It's been more than a quarter century since I've used a similar calculator (HP-48), so there's a lot for me to remember, understand, and explore.

One thing I don't understand: the time and date functions, which are Free42 extensions to the HP-42S functions.

When I call the DATE function, the X-register is:
2,020.0813
This is exactly what I expected. I prefer YMD, and the top strip om my calculator displays 2020-08-13.

However, when I call the DOW function when this number is in the X-register, I get:
Invalid Data
when I expected THU

Similarly, when I call DATE+ with 2,020.0813 in the Y-register and 10 in the X-register, I get:
Invalid Data
when I expected 2,020.0823

And when I call DDATE with 2,020.0813 in the Y-register rand 2,020.0814 in the Y-regsiter:
Invalid Data
when I expected 1

I'm not understanding something fundamental here... what am I doing wrong? Thank you.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: time and date functions

Post by Thomas Okken »

WLVA wrote:
Thu Aug 13, 2020 6:38 pm
When I call the DATE function, the X-register is:
2,020.0813
This is exactly what I expected. I prefer YMD, and the top strip om my calculator displays 2020-08-13.

However, when I call the DOW function when this number is in the X-register, I get:
Invalid Data
when I expected THU

Similarly, when I call DATE+ with 2,020.0813 in the Y-register and 10 in the X-register, I get:
Invalid Data
when I expected 2,020.0823

And when I call DDATE with 2,020.0813 in the Y-register rand 2,020.0814 in the Y-regsiter:
Invalid Data
when I expected 1

I'm not understanding something fundamental here... what am I doing wrong? Thank you.
SwissMicros will have to weigh in on that one. The DATE+ and DDAYS functions work fine in Free42, and also on my DM42, running DM42 3.15 and DMCP 3.17.
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: time and date functions

Post by rprosperi »

WLVA wrote:
Thu Aug 13, 2020 6:38 pm
I have had my DM42 (S/N 05503) for a couple of weeks. It's been more than a quarter century since I've used a similar calculator (HP-48), so there's a lot for me to remember, understand, and explore.

One thing I don't understand: the time and date functions, which are Free42 extensions to the HP-42S functions.

When I call the DATE function, the X-register is:
2,020.0813
This is exactly what I expected. I prefer YMD, and the top strip om my calculator displays 2020-08-13.

However, when I call the DOW function when this number is in the X-register, I get:
Invalid Data
when I expected THU

Similarly, when I call DATE+ with 2,020.0813 in the Y-register and 10 in the X-register, I get:
Invalid Data
when I expected 2,020.0823

And when I call DDATE with 2,020.0813 in the Y-register rand 2,020.0814 in the Y-regsiter:
Invalid Data
when I expected 1

I'm not understanding something fundamental here... what am I doing wrong? Thank you.
Either you need to update to the latest f/w (DM42 3.15) or it seems you're doing something wrong; are you sure you're in YMD mode? From the first item, it appears that is correct, but something else must be amiss as they all work right for me as well. Also DOW returns a number, not a string (Sun=0, Mon=1, etc.)
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: time and date functions

Post by Thomas Okken »

rprosperi wrote:
Fri Aug 14, 2020 10:43 pm
DOW returns a number, not a string (Sun=0, Mon=1, etc.)
Yes, but when executed from the keyboard, DOW also displays the day of the week as a 3-character string.
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: time and date functions

Post by rprosperi »

Thomas Okken wrote:
Fri Aug 14, 2020 11:18 pm
rprosperi wrote:
Fri Aug 14, 2020 10:43 pm
DOW returns a number, not a string (Sun=0, Mon=1, etc.)
Yes, but when executed from the keyboard, DOW also displays the day of the week as a 3-character string.
I don't think I ever noticed that before on Free42. Thanks.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
grsbanks
Posts: 1122
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: time and date functions

Post by grsbanks »

This appears to be a problem with the DM42 implementation of Free42.

If you use the Free42 command "YMD" to select this mode, then the commands in the example all work.

If you use the DM42's settings menu to go into YMD mode from, say, DMY mode, then you get these errors. I'll pass this along to the devs.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
grsbanks
Posts: 1122
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: time and date functions

Post by grsbanks »

I've figured out what's happening here.

The DM42 app is setting flag 67 when going into YMD mode but not clearing flag 31. We were working under the (obviously false) impression that flag 67 overrode flag 31 and that it therefore didn't matter what state flag 31 was in. Clearly it does :)

So that's the work-around until the next firmware is released. Either use the [YMD] command from the function catalogue or, if you use the DM42's time and date settings page, then you'll have to make sure flag 31 is clear.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: time and date functions

Post by Thomas Okken »

Free42 shows the same behavior when you do YMD followed by SF 31. It's an odd use case, but flag 31 shouldn't matter when flag 67 is set, so that is a bug. I'll fix it in 2.5.20.

UPDATE: Yep, the date2comps() function, which extracts the year, month, and day components from a date, swaps the month and day if flag 31 is set. It should only do that if flag 31 is set and flag 67 is clear.
WLVA
Posts: 7
Joined: Sat Jul 11, 2020 5:05 pm

Re: time and date functions

Post by WLVA »

grsbanks wrote:
Sat Aug 15, 2020 9:59 am
I've figured out what's happening here.

The DM42 app is setting flag 67 when going into YMD mode but not clearing flag 31. We were working under the (obviously false) impression that flag 67 overrode flag 31 and that it therefore didn't matter what state flag 31 was in. Clearly it does :)

So that's the work-around until the next firmware is released. Either use the [YMD] command from the function catalogue or, if you use the DM42's time and date settings page, then you'll have to make sure flag 31 is clear.
Thank you! Because I'm very new to this device and haven't used a similar calculator in decades, I'm learninig its capabilities both by playing around (which is how I encountered this date issue) and by methodically reading through the HP-42S, Free42, and DM42 documentation. It sure would be nice if the HP-42S manual could be searched more easily, but my copy appears to be a scan.

Appendix C of the HP-42S Owner's Manual only describes flags 31 and 67 as "reserved" for future use. Is there a more complete and updated catalog of the control flags (11 through 35) and system flags (36 through 80)? I seem to be the only person at the party who doesn't know what each flag signifies.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: time and date functions

Post by Thomas Okken »

WLVA wrote:
Sun Aug 16, 2020 2:46 pm
Appendix C of the HP-42S Owner's Manual only describes flags 31 and 67 as "reserved" for future use. Is there a more complete and updated catalog of the control flags (11 through 35) and system flags (36 through 80)? I seem to be the only person at the party who doesn't know what each flag signifies.
The HP-42S manual is a good reference, but Free42 uses a few flags that are unused on the real calculator. They are discussed here: viewtopic.php?f=19&t=2506&p=16171#p16171
Post Reply