Request: time/date setter

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Request: time/date setter

Postby Fujiyama » Mon Jan 28, 2008 2:48 am

I don't know if this is too much to ask, but is there someone out there who would be willing to create a time and date-setter program meant to go in the AUTO folder so that people won't forget to set the clock?
(this applies for any ST/STf/STfm/STe which doesn't have a battery-backed clock like the Mega ST/STe).

I've found such a program actually, but unfortunately it's not Y2K compatible, and the programmer is unreachable.
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: Request: time/date setter

Postby Desty » Mon Jan 28, 2008 4:07 am

Hey,

I tried this in Sozobon C, but it doesn't seem to have any effect. Not sure why; I stole the BIOS_TIME struct from the Atari Compendium. It didn't work with Tsettime() either. Maybe it's because I'm running under Hatari, or I'm just doing it wrong :)

Code: Select all

#include <stdio.h>
#include <tosbind.h>

typedef struct {
 unsigned year:7;
 unsigned month:4;
 unsigned day:5;
 unsigned hour:5;
 unsigned minute:6;
 unsigned second:5;
} BIOS_TIME;

void main() {
   int h, m, s, day, month, year;
   long *ltime;
   BIOS_TIME btime;
   printf("Time: %d\n", Tgettime());
   printf("\nhh: ");
   scanf("%d", &h);
   printf("\nmm: ");
   scanf("%d", &m);
   printf("\nss: ");
   scanf("%d", &s);
   printf("\nDay: ");
   scanf("%d", &day);
   printf("\nMonth: ");
   scanf("%d", &month);
   printf("\nYear: ");
   scanf("%d", &year);

   btime.year = year - 1980;
   btime.month = month;
   btime.day = day;
   btime.hour = h;
   btime.minute = m;
   btime.second = s/2;
   ltime = &btime;
   Settime(*ltime);
}
tá'n poc ar buile!

User avatar
nobogod
Captain Atari
Captain Atari
Posts: 194
Joined: Wed Aug 04, 2004 12:58 pm
Location: Athens, Greece
Contact:

Re: Request: time/date setter

Postby nobogod » Mon Jan 28, 2008 10:46 am

Ok,
I upload a little program i've made myself a long time ago... (those were the days! LoL)

It's a little prg that allows you to set date/time and then it saves it inside the prg!
So you can use them next time.

I found it better-easyer-faster to use only the cursor keys to do the job.

How to use:
Cursor Up: Increase Day (Hour)
Cursor Down; Decrease Day (Hour)
Cursor Left: Increase Month (Minute)
Cursor Right; Decrease Month (Minute)
Tab or Del or Backspace: Select Date/Time
Insert: Use System Date/Time
ClrHome: Use latest Date/Time
Help: Use new Date/Time, save it and exit
Undo or Esc: Don't change anything and exit

You can't edit Seconds (sorry).
Try it. it's not so complicated as it seems.

(Hint: After a warm reset you can just press Insert and then Help to do your job)
You do not have the required permissions to view the files attached to this post.

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Thu Jan 31, 2008 7:51 am

Your program does the job -it seems to be Y2K compatible.
But the input method is way too complicated. For people who have to do this every day I think they'd rather skip the whole thing than remembering which key does what :(

Would it be a lot of work to edit the source code, changing the input-method?
I have some suggestions if that's possible.
The rest of the program seems to work fine (although I currently don't have any non-battery backed ST to test it on, so I can't vouch 100% for that).
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

User avatar
nobogod
Captain Atari
Captain Atari
Posts: 194
Joined: Wed Aug 04, 2004 12:58 pm
Location: Athens, Greece
Contact:

Re: Request: time/date setter

Postby nobogod » Thu Jan 31, 2008 3:06 pm

Fujiyama wrote:Your program does the job -it seems to be Y2K compatible.
But the input method is way too complicated. For people who have to do this every day I think they'd rather skip the whole thing than remembering which key does what :(


In fact, the only keys you need are the cursor keys, Help and Tab (or DEL)
Note that they are in the same area of the keyboard.

And I really believe that using the cursor keys instead of the numbers is faster and easier.
Think of the date. You will only have to do just one keystroke (if you have used it the day before) or none (if you have used it the same day)!

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: Request: time/date setter

Postby Nyh » Thu Jan 31, 2008 3:56 pm

Fujiyama wrote:I don't know if this is too much to ask, but is there someone out there who would be willing to create a time and date-setter program meant to go in the AUTO folder so that people won't forget to set the clock?
(this applies for any ST/STf/STfm/STe which doesn't have a battery-backed clock like the Mega ST/STe).

I've found such a program actually, but unfortunately it's not Y2K compatible, and the programmer is unreachable.

Well, I put together a little program. It assumes when the current year is 2000 or more the right date is set (a kind of reverse Y2k problem ;-) ) and will not bother you to set a new date and time.

The program tries to validate input as soon as it is entered. I tried my very best to block all possible wrong input. Please test the program and report any bugs or improvement suggestions. When the day of the month is between 04 and 09 you don't have to type the zero and you can directly press the 4..9 because no month has more then 31 days. The program will add the 0 before the 4-9. Same is true for hours (03-09) and minutes (07-09).

The program is called DATE2008.PRG. When you put it in the AUTO folder it will find itself and set the year to 2008. If it cannot find itself it will ask for the year too else you can not enter the year. To advance to 2009 simply rename the program to DATE2009.PRG.

You can enter the current date and time like 31011645. As soon as you enter the correct minutes it will do a final check on the date and if correct set the date and time of the computer. No <enter> or <return> presses needed! You can use cursor keys, return/enter keys and backspace to go through the input fields.

The C-source is included.

Hans Wessels
You do not have the required permissions to view the files attached to this post.

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: Request: time/date setter

Postby Desty » Thu Jan 31, 2008 4:07 pm

Nyh wrote:The program is called DATE2008.PRG. When you put it in the AUTO folder it will find itself and set the year to 2008. If it cannot find itself it will ask for the year too else you can not enter the year. To advance to 2009 simply rename the program to DATE2009.PRG.

...Well that's fiendishly clever, nice touch. :P
tá'n poc ar buile!

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Wed Feb 06, 2008 3:32 pm

I tried the DATE2008.PRG with my MegaSTe, but it didn't do anything (which makes sense I guess, having a battery which keeps the time), so I removed its clock-battery and tried again. Still nothing.
Next I dusted off my STe (which also has a battery-backed clock, but which I removed), but still nothing happens when placed inside the AUTO folder. Strange :?

In your explanation it sounds like a great time-setter for you and me, but perhaps not exactly what I'm looking for.
You see, I know several people who use their STs for just one MIDI program. They're not exactly what you'd call "computer people", so even renaming a file once a year will most likely be forgotten. And since they usually boot from a read-only program disk they'll run into problems when the program tries to write to the floppy. It also takes longer (most of these people don't have hard-drive systems).

I'm not trying to be negative here, but realistic :(
Without a super-simple program which is self-explanetory (or has simple instructions) I think any effort into this is a waste of time as they really won't use it. The aim of the whole thing is help them find a solution to their files having silly dates.

One question: when the computer has been turned on for the first time (again, this is with a standard ST without a battery-backed clock), and the time has been set (using the control panel or some sort of time-setter program), will the clock continue running correctly as long as the computer is turned on, or will things get messed up when the computer is reset?
If the time is kept as long as the computer is powered up, would it be possible to set up the AUTO-folder's time-setter program only to be actived under a cold-boot/reboot?
That would eliminate the need for the user to enter the time/date for a normal reset at least.

By the way, the time-setter I talked about which seems to do the job the way I want (as far as I could tell) except that it has a Y2K problem (it won't accept any current date) is enclosed here. Like I said, I can't get hold of the author, and unfortunately there's no source code included.
Is it hard to dis-assemble an already compiled program, in order to modify it?
You do not have the required permissions to view the files attached to this post.
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

whyatmyage
Atari User
Atari User
Posts: 34
Joined: Wed Jan 16, 2008 9:59 am
Location: Gloucestershire, UK

Re: Request: time/date setter

Postby whyatmyage » Thu Feb 07, 2008 8:47 am

Well that Date2008.prg thingy works for me. I made a folder called AUTO, put Date2008.prg in it, that is on my music sequencer floppy. Switch the ST on, within seconds up pops the date entry section, which seems quick and easy, the thing then vanishes leaving me with the correct time/date until I switch off/reboot. I can't complain!

For me this is the most I can expect without a proper battery back up clock thing. I'm using 1040 STF TOS1.0 in hi-rez

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: Request: time/date setter

Postby Nyh » Thu Feb 07, 2008 10:42 am

Fujiyama wrote:Next I dusted off my STe (which also has a battery-backed clock, but which I removed), but still nothing happens when placed inside the AUTO folder. Strange :?

Mighty strange. Although I only tested under STeem, I really expect it to work on real ST's too... Just tested it on a normal ST. The downloaded version works fine on my 1040 ST. I will try later on some other machines.

Fujiyama wrote:You see, I know several people who use their STs for just one MIDI program. They're not exactly what you'd call "computer people", so even renaming a file once a year will most likely be forgotten. And since they usually boot from a read-only program disk they'll run into problems when the program tries to write to the floppy. It also takes longer (most of these people don't have hard-drive systems).

Rename the program to DATE.PRG or anything else, as long as it is not DATExxxx.PRG with xxxx a valid TOS year. When the program doesn't find itself with a valid year in its name you will have to enter a valid year too.

Fujiyama wrote:One question: when the computer has been turned on for the first time (again, this is with a standard ST without a battery-backed clock), and the time has been set (using the control panel or some sort of time-setter program), will the clock continue running correctly as long as the computer is turned on, or will things get messed up when the computer is reset?

No, the time is stored in the keyboard processor. Very unlikely to get messed up there.

Fujiyama wrote:If the time is kept as long as the computer is powered up, would it be possible to set up the AUTO-folder's time-setter program only to be actived under a cold-boot/reboot?
That would eliminate the need for the user to enter the time/date for a normal reset at least.

My program works this way as it want the year to be post 2000.

Fujiyama wrote:Is it hard to dis-assemble an already compiled program, in order to modify it?

As I released my time/date setter with full sources it will be more work to disassemble an other program then to modify the source of my program.

Hans Wessels

ppera

Re: Request: time/date setter

Postby ppera » Thu Feb 07, 2008 4:05 pm

Here is little different working time setter/keeper program:

It stores time in KBD chip too, but needs not to be put in AUTO folder. It sets small resident code which takes time from KBD chip after resetting machine. So, it is enough to run it once after power-up.
If run again (without power-off) then it will outprint current date, time, and may change. In any case it will say that resident routine is already set, just press some key to exit.
Program prints out date in day, month, year order (Central Europe !)
Source is included - best assemble with Devpac.

Only problem may be conflict with some other SW which uses same reset-resident system function (place for it is address range hex600-hex800 ).
You do not have the required permissions to view the files attached to this post.

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Sun Feb 10, 2008 5:05 pm

I hadn't forgotten about it Ppera, just haven't gotten round to trying it out before now :wink:
It seems to work fine until I reset the computer. I then get the following error message:

Time refresh routine
already installed
or area at $700 occupied!
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

ppera

Re: Request: time/date setter

Postby ppera » Mon Feb 11, 2008 9:36 am

Fujiyama wrote:...
It seems to work fine until I reset the computer. I then get the following error message:

Time refresh routine
already installed
or area at $700 occupied!


It is not error message, just information - because it needs to install only once.
You don't need to put it in AUTO folder (as is said here), and run only once - after power on. It survives reset - that's the point. Only after cold reset need to run it again, and even then it will get time from KBD chip.
If you insist on running from AUTO (don't see why it would be better, but...) then it is easy to modify - just need to drop out all resident installing and running sections.

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Mon Feb 11, 2008 1:26 pm

Ah, I see.
So it won't cause any conflict with other programs then?

The whole point of the time setter is to put it in the AUTO folder so that people without battery backed clocks are told to set the time/date.
If you're going to modify the program, removing that code, I also have some ideas about entering the time/date which would be quicker.
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

ppera

Re: Request: time/date setter

Postby ppera » Mon Feb 11, 2008 6:01 pm

Fujiyama wrote:...
If you're going to modify the program, removing that code, I also have some ideas about entering the time/date which would be quicker.


I'm listening...

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Wed Feb 13, 2008 8:47 am

Here's my suggestion for the user-interface.
First, when the computer is booting an inverted (black background with white text) will make it stand out and alert the user about something (inverted shown here in blue):

Clock setter by Ppera (c) 2008

Date: Sunday, 00-00-0028
Time: 00:00:25

RETURN to accept
or SPACE to change


If the user presses SPACE this will come up:

Date: DD-MM-YY
RETURN when done


Blue indicates inverted text, so here the "DD" will be inverted.
The user types 13, and the cursor automatically jumps past the first "-" and makes "MM" inverted.
Date: 13-MM-YY
RETURN when done


Now the user types 02 and the cursor automatically jumps past the final "-" and inverts "YY".
Date: 13-02-YY
RETURN when done


At last the user types 08 and presses RETURN to move on (if everything looks OK).
The left/right arrow keys can be used any time to move from one set of digits to the other. Entering new numbers will overwrite whatever is highlighted.

My point is that each two digits which is waiting for input is inverted and when filled with two digits it jumps on to the next two digits. The "-" can't be overwritten and is used to separate things, making it easier for the user to see.

Next the time comes up in a similar way, but with ":" to separate:

Time: HH:MM:SS
RETURN when done


When the user has entered the time and RETURN the new time and date is displayed, but with a final confirmation:

Date: 13-02-2008
Time: 08:58:03

RETURN to accept
or SPACE to change


If the user sees a mistake he can press SPACE, which will bring him back to entering the date, then time again.

Since people in Europe and USA enter the date differently I suggest two different versions of the program, each with its own date format. The user can place the one he prefers in the AUTO folder.
(I think that'll make it easier than asking the user about even one more thing to set).
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: Request: time/date setter

Postby Desty » Wed Feb 13, 2008 11:53 am

Or you could use Nyh's technique, just rename the program as DDMMYY.TOS for everywhere else, or MMDDYY.TOS for USA and refer to args[0] or whatever it is in assembly to decide the format? (Or just CLOCKSET / CLOCKUSA)
tá'n poc ar buile!

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: Request: time/date setter

Postby Nyh » Wed Feb 13, 2008 12:26 pm

Desty wrote:Or you could use Nyh's technique, just rename the program as DDMMYY.TOS for everywhere else, or MMDDYY.TOS for USA and refer to args[0] or whatever it is in assembly to decide the format? (Or just CLOCKSET / CLOCKUSA)

args[0] doesn't work under TOS. I wish it would. Would make life a lot easier.

Hans Wessels
PS: included date setter that comes close to the wish list.
You do not have the required permissions to view the files attached to this post.

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: Request: time/date setter

Postby Desty » Wed Feb 13, 2008 1:54 pm

Nyh wrote:args[0] doesn't work under TOS. I wish it would. Would make life a lot easier.

Ouch... is there some dodgy GEMDOS call that provides the same functionality, or do you have to implement a ridiculous hack like checking the current directory for the expected names?
tá'n poc ar buile!

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: Request: time/date setter

Postby Nyh » Wed Feb 13, 2008 3:05 pm

Desty wrote:
Nyh wrote:args[0] doesn't work under TOS. I wish it would. Would make life a lot easier.

Ouch... is there some dodgy GEMDOS call that provides the same functionality, or do you have to implement a ridiculous hack like checking the current directory for the expected names?

Well, you need some dodgy GEMDOS calls indeed. They are called FSFIRST() and FSNEXT(). Directory to search: /auto/ (when executing the auto folder the current directory is / and not /auto/).

Hans Wessels

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: Request: time/date setter

Postby Desty » Wed Feb 13, 2008 3:27 pm

Nyh wrote:Well, you need some dodgy GEMDOS calls indeed. They are called FSFIRST() and FSNEXT(). Directory to search: /auto/ (when executing the auto folder the current directory is / and not /auto/).

Wow, that's two kicks up the arse for free... 1) no argv[0], 2) confused current directory as an auto ;)
tá'n poc ar buile!

ppera

Re: Request: time/date setter

Postby ppera » Wed Feb 13, 2008 4:40 pm

Desty wrote:Or you could use Nyh's technique, just rename the program as DDMMYY.TOS for everywhere else, or MMDDYY.TOS for USA and refer to args[0] or whatever it is in assembly to decide the format? (Or just CLOCKSET / CLOCKUSA)


I think that much simpler is to make 2 versions of proggy. Name one as "for dumb Others", another "for Stupid Amers" :mrgreen:

ppera

Re: Request: time/date setter

Postby ppera » Fri Feb 15, 2008 11:41 am

Well, some serious ideas:

To making usage as fast as possible, and satisfy diverse Day/Month orders, I think that simple INF (ot whatever) parameter storage file should be used:
Content: localization - in fact just flag for US or European Day/Month order
Current year and month.

To spare user from hard work of filling (making) INF file prog. should generate it at first start - so it will ask for localization if not finds valid INF file. Year and month will be written always by exiting program.

Couple keys for extra functions: R - set region S - skip year and month entering (or reversed, extra key for entering them).

User avatar
Fujiyama
Atari Super Hero
Atari Super Hero
Posts: 649
Joined: Thu Jul 12, 2007 8:21 am
Location: Norway

Re: Request: time/date setter

Postby Fujiyama » Sat Feb 23, 2008 3:24 pm

Nyh wrote:
Desty wrote:PS: included date setter that comes close to the wish list.


Just tried it out on my Mega STe and under the Hatari emulator on my Mac.
Seems to work well, although I have to dig out my STe to see how it behaves without a battery-backed clock.

Obviously without a battery there won't be any year that makes sense. From memory I believe the default date on a battery-less ST is "00-00-28". I used to have lots of files with stupid dates like that back in the days.
I don't know much about programming like I've said, but all that talk about dirty tricks makes me worried about incompatibility with Notator (which is very picky to begin with). And with a battery-backed clock the time can be set with the Xcontrol control panel or a replacement.

I was going to suggest that you put a final confirmation dialog in there, but then I realized that backspace allows me to reenter the date even when I'm in the time area. Good!
Could you add something like this line:

RETURN to accept
BACKSPACE to change

Finally, I suggest a separate USA version where the date is entered in the US format.
Mega STe | MonSTer (Mega STe) with dual IDE-CF memory card adapter | STe | SM-144 |NEC Multisync 1990SXi | IDE doubler | ST_ESCC | RSVE | ICD Link II | Link '97 | HD floppy drive/AJAX | HD floppy module | Minolta PCMCIA card-drive | Realtime Clock module | Discovery cartridge | Unitor-2 | Export | Combiner | Steady Eye | Human Touch | Unicorn USB

Are you a good person?


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: beel1 and 6 guests