Page 1 of 1

Date and Time API?

Posted: Thu Apr 11, 2024 9:40 pm
by AGMS
I was thinking of putting in a date stamp for people getting high scores in a game, but noticed that there's no way of finding it out. CP/M 3 has date and time, but we're using 2.2 which doesn't. Also nothing in NABU-LIB. Was there something in the original NABU OS that did it? Or should it be done as a RetroNet command to the adapter to get the time stamp?

If so, please return something with 4+ digit year, month, day, hour, minute, second and time zone (taken from the computer hosting the adapter). Could be just a string. On Linux the date can take a format string and spit out everything needed. Assume the NABU side will handle localisation of month and day names. Include day of week to avoid some tricky computations. Have both the numeric time zone (so we can calculate UTC time) and time zone name (can't figure it out otherwise and need it for showing the user):

date "+%F %T %z %Z %u"
2024-04-14 19:04:01 -0400 EDT 7

And hey, then someone could write a NABU clock display, one which plays music on the hour :-)

- Alex

Re: Date and Time API?

Posted: Wed Apr 17, 2024 3:32 am
by DJ Sures
Hey there - sorry I didn't see this - ProductionDave mentioned your question in Discord. I updated the IA Control library to include this ability. You can provide a format to the request so any structure can be returned.

https://github.com/DJSures/NABU-LIB/tree/main/NABULIB

Find it in the IA Control

Re: Date and Time API?

Posted: Wed Apr 17, 2024 3:37 am
by DJ Sures
I should also mention the formatting for your example would be like.. "yyyy-MM-dd HH:mm:ss"

Re: Date and Time API?

Posted: Sun Apr 21, 2024 9:37 pm
by AGMS
Great, thanks! Nice to see the possible date format codes are in the comment, and there are ones for time zone and year so UTC time stamps are possible.