You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
394 B
C
20 lines
394 B
C
#include "time.h"
|
|
|
|
// Standard Library
|
|
#include <stdio.h>
|
|
|
|
void rfc3339_time_string( time_t when, char* result, int size )
|
|
{
|
|
struct tm gmtime_data;
|
|
gmtime_r( &when, &gmtime_data );
|
|
snprintf( result, size, "%04d-%02d-%02dT%02d:%02d:%02dZ",
|
|
gmtime_data.tm_year + 1900,
|
|
gmtime_data.tm_mon + 1,
|
|
gmtime_data.tm_mday,
|
|
gmtime_data.tm_hour,
|
|
gmtime_data.tm_min,
|
|
gmtime_data.tm_sec
|
|
);
|
|
}
|
|
|