[comp.os.os9] os9 time help.

akcs.scw@vpnet.chi.il.us (scott whittle) (06/18/91)

Help
I'm running OS/9 Professional on a 68030 system. I'm trying to get the
date and time from the system with this bit of programing.

#include <stdio.h>

main()
{
int *time,*date,*tick;
short *day;

_sysdate(0,&time,&date,&day,&tick);

printf("Time is Time:%d  date:%d  date:%d tick:%d",time,date,day,tick);

}

no big deal right. but this is what I get;
for the time and date of june 17, 1991 3:16:47 pm.

time:987183
date 130483729
day 65536
tick 108236
I don't know what or how to make of it but if somebody could give me some
tips I would greatly appreciated. Thanks scott

tony@mwuk.UUCP (Tony Mountifield) (06/19/91)

In article <285d1b3f-1b4comp.os.os9@vpnet.chi.il.us> akcs.scw@vpnet.chi.il.us (scott whittle) writes:
-> Help
-> I'm running OS/9 Professional on a 68030 system. I'm trying to get the
-> date and time from the system with this bit of programing.
-> 
-> #include <stdio.h>
-> 
-> main()
-> {
-> int *time,*date,*tick;
-> short *day;
-> 
-> _sysdate(0,&time,&date,&day,&tick);
-> 
-> printf("Time is Time:%d  date:%d  date:%d tick:%d",time,date,day,tick);
-> 
-> }

If you look at the example in the C Compiler Manual for _sysdate(), you
will see that you should have declared the variables without the '*'s:

	int time,date,tick;
	short day;

You were probably getting misled by the synopsis, which describes what
TYPES of parameter _sysdate() is expecting. You were passing it
pointers-to-(pointers which don't yet point anywhere).

Hope this helps.

-- 
Tony Mountifield.                | Microware Systems (UK) Ltd.
MAIL:  tony@mwuk.uucp            | Leylands Farm, Nobs Crook,
INET:  tony%mwuk.uucp@ukc.ac.uk  | Colden Common, WINCHESTER, SO21 1TH.
UUCP:  ...!mcsun!ukc!mwuk!tony   | Tel: 0703 601990   Fax: 0703 601991
**** OS-9, OS-9000 Real Time Systems **** MS-DOS - just say "No!" ****

rh2y+@andrew.cmu.edu (Russell E. Hoffman, II) (06/30/91)

Unsure if someone else has already answered your question, but, here goes:
The time and date returned by that call are encoded in 4-byte integers.
each byte of the integer represents the hour, minute, and second. See
the Microware C manual for more on this.

Russ