I don't know if you had the same issue before, but I am using GetSysTime() to get the system date, and more specifically, the seconds number. This returns a 10 digit timestamp of the current date, or at least it should return that.
What I get is the right day, month and hour of the moment I run it, but minus 8 years. Of' course, the time on my system is synced and shows the right date, bit the GetSysTime() keeps giving a wrong year.
I use it at the following method:
- STRPTR now(void)
- uint8 timestampLen = 12;
- STRPTR buf = IExec->AllocVecTags(sizeof(char) * timestampLen,
- AVT_Type, MEMF_SHARED,
- AVT_ClearWithValue, "\0",
- struct TimeVal tv;
- IUtility->SNPrintf(buf, sizeof(char) * timestampLen, "%lu", tv.Seconds);
- return buf;
And below you can see how I initiate and open the timer device
- TimerMP = IExec->AllocSysObject(ASOT_PORT, NULL);
- if (TimerMP != NULL)
- TimeReq = IExec->AllocSysObjectTags(ASOT_IOREQUEST,
- ASOIOR_Size, sizeof(struct TimeRequest),
- ASOIOR_ReplyPort, TimerMP,
- if (TimeReq != NULL)
- if (!IExec->OpenDevice("timer.device", UNIT_VBLANK, (struct IORequest *)TimeReq, 0))
- if ((TTimerBase = (struct Library *)TimeReq->Request.io_Device))
- ITimer = (struct TimerIFace *)IExec->GetInterface(TTimerBase, "main", 1, NULL);
- if(!ITimer) return CleanExit("Can't open timer device Interface");
- else return CleanExit("Can't open timer device");
- else return CleanExit("Can't open timer device. Timer request failed.");
- else return CleanExit("Can't open timer device. Timer msgport failed.");
The system I am running it is an X5000/40 with latest AmigaOS 4.1 FEupd2.
Any idea why this is happening and how I can overcome that? Should I use some other function to get the right time?