MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
cpptoml::offset_datetime Struct Reference

#include <cpptoml.h>

Inheritance diagram for cpptoml::offset_datetime:
[legend]
Collaboration diagram for cpptoml::offset_datetime:
[legend]

Public Member Functions

 CPPTOML_DEPRECATED ("from_local has been renamed to from_zoned") static inline offset_datetime from_local(const tm &t)
 

Static Public Member Functions

static offset_datetime from_zoned (const tm &t)
 
static offset_datetime from_utc (const tm &t)
 

Additional Inherited Members

- Public Attributes inherited from cpptoml::local_date
int year = 0
 
int month = 0
 
int day = 0
 
- Public Attributes inherited from cpptoml::local_time
int hour = 0
 
int minute = 0
 
int second = 0
 
int microsecond = 0
 
- Public Attributes inherited from cpptoml::zone_offset
int hour_offset = 0
 
int minute_offset = 0
 

Detailed Description

Definition at line 152 of file cpptoml.h.

Member Function Documentation

◆ CPPTOML_DEPRECATED()

cpptoml::offset_datetime::CPPTOML_DEPRECATED ( "from_local has been renamed to from_zoned"  ) const &
inline

Definition at line 171 of file cpptoml.h.

172 { return from_zoned(t); }
static offset_datetime from_zoned(const tm &t)
Definition: cpptoml.h:153

◆ from_utc()

static offset_datetime cpptoml::offset_datetime::from_utc ( const tm &  t)
inlinestatic

Definition at line 174 of file cpptoml.h.

174 {
175 offset_datetime dt;
176 dt.year = t.tm_year + 1900;
177 dt.month = t.tm_mon + 1;
178 dt.day = t.tm_mday;
179 dt.hour = t.tm_hour;
180 dt.minute = t.tm_min;
181 dt.second = t.tm_sec;
182 return dt;
183 }

◆ from_zoned()

static offset_datetime cpptoml::offset_datetime::from_zoned ( const tm &  t)
inlinestatic

Definition at line 153 of file cpptoml.h.

153 {
154 offset_datetime dt;
155 dt.year = t.tm_year + 1900;
156 dt.month = t.tm_mon + 1;
157 dt.day = t.tm_mday;
158 dt.hour = t.tm_hour;
159 dt.minute = t.tm_min;
160 dt.second = t.tm_sec;
161
162 char buf[16];
163 strftime(buf, 16, "%z", &t);
164
165 int offset = std::stoi(buf);
166 dt.hour_offset = offset / 100;
167 dt.minute_offset = offset % 100;
168 return dt;
169 }

The documentation for this struct was generated from the following file: