I am writing a WIN32 C-program for a Motorola MC-55A PDA using Windows Mobile 5.0 SDK. I'm trying to get the current date and time to get a DDMMYYYYHHMMSS unique string that I can use. I've checked the tutorials and tried to use time_t and SYSTEMTIME but its coming back with the error : " illegal use of this type as an expression" (see code below). I've included the required header files including "time.h" but the error persists with the use of time_t and SYSTEMTIME . Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <windows.h>
#include <windowsx.h>
.
.
.
case WM_INITDIALOG:
//Below fails with error : 'time_t' : illegal use of this type as an expression
//C:\Program Files (x86)\Windows Mobile 5.0 SDK R2\PocketPC\include\ARMV4I\stdlib.h :
//see declaration of 'time_t
time_t current_time = time(NULL);
printf("Hours since January 1, 1970 = %ld\n", current_time/3600);
//This also fails
time_t now;
time(&now);
//SYSTEMTIME below also fails with error : 'SYSTEMTIME' : illegal use of this type as an expression
//C:\Program Files (x86)\Windows Mobile 5.0 SDK R2\PocketPC\include\ARMV4I\winbase.h :
//see declaration of 'SYSTEMTIME'
GetSystemTime(&st);
GetLocalTime(<);
printf("The system time is: %02d:%02d\n", st.wHour, st.wMinute);
printf(" The local time is: %02d:%02d\n", lt.wHour, lt.wMinute);
How do I get the current date and time?