Skip to content

Instantly share code, notes, and snippets.

@nramsbottom
Created April 1, 2015 16:42
Show Gist options
  • Select an option

  • Save nramsbottom/878dc85d728418893ff7 to your computer and use it in GitHub Desktop.

Select an option

Save nramsbottom/878dc85d728418893ff7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <time.h>
static char dttm[20];
const char *get_utc_date() {
time_t now;
struct tm *utcdate;
time(&now);
utcdate = gmtime(&now);
sprintf(
dttm,
"%04d-%02d-%02d %02d:%02d:%02d",
utcdate->tm_year + 1900,
utcdate->tm_mon,
utcdate->tm_mday,
utcdate->tm_hour,
utcdate->tm_min,
utcdate->tm_sec);
return dttm;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment