Skip to content

Instantly share code, notes, and snippets.

@enile8
Created January 8, 2013 03:26
Show Gist options
  • Select an option

  • Save enile8/4480931 to your computer and use it in GitHub Desktop.

Select an option

Save enile8/4480931 to your computer and use it in GitHub Desktop.
Display the current local time using C.
#include <stdio.h>
#include <time.h>
int main ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "Current local time and date: %s", asctime (timeinfo) );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment