Created
February 13, 2012 17:07
-
-
Save dermesser/1818344 to your computer and use it in GitHub Desktop.
Use of localtime()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <stdio.h> | |
# include <time.h> | |
# include <locale.h> | |
int main(void) | |
{ | |
time_t currtime = time(NULL); // time_t time(time_t *timep) | |
struct tm *local, *gmt; | |
local = localtime(&currtime); | |
printf("Current local time: %02i:%02i:%02i %02i.%02i.%i\n",local->tm_hour,local->tm_min,local->tm_sec,local->tm_mday,local->tm_mon + 1,local->tm_year + 1900); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment