Function from_zoned

Synopsis

#include <include/cpptoml.h>

static struct offset_datetime from_zoned(const struct tm &t)

Description

No description yet.

Mentioned in

Source

Lines 127-144 in include/cpptoml.h. Line 118 in include/cpptoml.h.

static inline struct offset_datetime from_zoned(const struct tm& t)
{
    offset_datetime dt;
    dt.year = t.tm_year + 1900;
    dt.month = t.tm_mon + 1;
    dt.day = t.tm_mday;
    dt.hour = t.tm_hour;
    dt.minute = t.tm_min;
    dt.second = t.tm_sec;
    char buf[16];
    strftime(buf, 16, "%z", &t);
    int offset = std::stoi(buf);
    dt.hour_offset = offset / 100;
    dt.minute_offset = offset % 100;
    return dt;
}





Add Discussion as Guest

Log in