Advertisement
tourniquet

Geting time trough WinApi

Dec 11th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <windows.h>
  2. #include <wchar.h>
  3. #include <unistd.h>
  4. #define sleep(x) Sleep(1000 * x)
  5.  
  6. int main ( void )  //getting local date and time function  -17:05:18 11.12.2012-
  7.     {
  8.        
  9.         SYSTEMTIME localTime, localDate;
  10.        
  11.         GetLocalTime ( &localTime );
  12.        
  13.         wprintf ( L"\rThe local time is: %02d:%02d:%02d %02d.%02d.%d", localTime.wHour, localTime.wMinute, localTime.wSecond, localTime.wDay, localTime.wMonth, localTime.wYear );
  14.         sleep(1);
  15.         main(); // call main function for unlimited time, but with 1 second delay time
  16.  
  17.     getch();
  18.     return 0;
  19.        
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement