Add time_t to rfc3339 date/time stamp function

master
teknomunk 10 months ago
parent ca54303b43
commit e133427bb7

@ -0,0 +1,19 @@
#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
);
}

@ -0,0 +1,6 @@
#pragma once
#include <time.h>
void rfc3339_time_string( time_t when, char* result, int size );
Loading…
Cancel
Save