Found this code on Amiga Wiki page, but seems not working or not updated
/* Get_Systime.c
*
* Get system time example
*
* Run from CLI only
*/
#include <exec/types.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <devices/timer.h>
#include <proto/exec.h>
#include <proto/dos.h>
int main(void)
{
int32 error;
uint32 days,hrs,secs,mins,mics;
struct MsgPort *TimerMP = IExec->AllocSysObjectTags(ASOT_PORT, TAG_END);
if (TimerMP != NULL)
{
struct TimeRequest *TimerIO = IExec->AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size, sizeof(struct TimeRequest),
ASOIOR_ReplyPort, TimerMP,
TAG_END);
if (TimerIO != NULL)
{
/* Open with UNIT_VBLANK, but any unit can be used */
if (!(error = IExec->OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)TimerIO,0L)))
{
/* Issue the command and wait for it to finish, then get the reply */
TimerIO->tr_node.io_Command = TR_GETSYSTIME;
IExec->DoIO((struct IORequest *) TimerIO);
/* Get the results and close the timer device */
mics = TimerIO->tr_time.tv_micro;
secs = TimerIO->tr_time.tv_secs;
/* Compute days, hours, etc. */
mins = secs / 60;
hrs = mins / 60;
days = hrs / 24;
secs = secs % 60;
mins = mins % 60;
hrs = hrs % 24;
/* Display the time */
IDOS->Printf("\nSystem Time (measured from Jan.1,1978)\n");
IDOS->Printf(" Days Hours Minutes Seconds Microseconds\n");
IDOS->Printf("%6ld %6ld %6ld %6ld %10ld\n", days, hrs, mins, secs, mics);
/* Close the timer device */
IExec->CloseDevice((struct IORequest *) TimerIO);
}
else
IDOS->Printf("\nError: Could not open timer device\n");
/* Delete the IORequest structure */
IExec->FreeSysObject(ASOT_IOREQUEST, TimerIO);
}
else
IDOS->Printf("\nError: Could not create I/O structure\n");
/* Delete the port */
IExec->FreeSysObject(ASOT_PORT, TimerMP);
}
else
IDOS->Printf("\nError: Could not create port\n");
return 0;
}
Gettime.c: In function 'main':
Gettime.c:39: error: 'struct TimeRequest' has no member named 'tr_node'
Gettime.c:43: error: 'struct TimeRequest' has no member named 'tr_time'
Gettime.c:44: error: 'struct TimeRequest' has no member named 'tr_time'
Gettime.c:78:2: warning: no newline at end of file
@xenic
Thank you for the info