Unfortunalelly I could not find proper procedure for getting current date and time. But it is possible to use WinApi functions. In our case we will import GetLocalTime funtion from Kernel32.dll.
This funcion requires a pointer to structure SYSTEMTIME:
void WINAPI GetLocalTime(And after calling this function this structure will be filled with data:
__out LPSYSTEMTIME lpSystemTime
);
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME,
*PSYSTEMTIME;Here is Pocket Scheme code that imports function GetLocalTime and usage.
(require "w32.dll")
(define *kdll*
(cond-expand
(windows-nt "kernel32.dll")
(windows-ce "coredll.dll")))
(define GetLocalTime
(w32:foreign-procedure *kdll* "GetLocalTime" '(w32api void lpvoid)))
; outputs current year
(let ((rgw (make-raw-vector 8 'u16)))
(begin
(GetLocalTime rgw)
(display (raw-vector-ref rgw 0)) ; outputs current year
)
)

