4#ifndef _TIME_SHIELD_TIME_ZONE_STRUCT_HPP_INCLUDED
5#define _TIME_SHIELD_TIME_ZONE_STRUCT_HPP_INCLUDED
30 const bool& is_positive =
true) {
41 int abs_val = std::abs(offset);
44 bool is_positive = (offset >= 0);
61 return std::string(1, sign) + (tz.
hour < 10 ?
"0" :
"") + std::to_string(tz.
hour) +
":" + (tz.
min < 10 ?
"0" :
"") + std::to_string(tz.
min);
Header file with time-related constants.
Main namespace for the Time Shield library.
const std::string & to_str(const Weekday &value, const FormatType &format=UPPERCASE_NAME)
Converts a Weekday enum value to a string.
const TimeZoneStruct create_time_zone_struct(const int &hour, const int &min, const bool &is_positive=true)
Creates a TimeZoneStruct instance.
const std::string to_string(const std::string &format_str, const T ×tamp, const tz_t &utc_offset=0)
Convert timestamp to string with custom format.
const TimeZoneStruct to_time_zone_struct(const tz_t &offset)
Converts an integer to a TimeZoneStruct.
constexpr int64_t SEC_PER_MIN
Seconds per minute.
constexpr int64_t SEC_PER_HOUR
Seconds per hour.
const tz_t time_zone_struct_to_offset(const TimeZoneStruct &tz)
Converts a TimeZoneStruct to a single integer representation.
const tz_t tz_to_offset(const TimeZoneStruct &tz)
Alias for time_zone_struct_to_offset function.
const std::string time_zone_struct_to_string(const TimeZoneStruct &tz)
Converts a TimeZoneStruct to a string representation.
const TimeZoneStruct to_tz(const tz_t &offset)
Alias for to_time_zone_struct function.
const tz_t to_offset(const TimeZoneStruct &tz)
Alias for time_zone_struct_to_offset function.
Structure to represent time zone information.
int hour
Hour component of time (0-23)
int min
Minute component of time (0-59)
bool is_positive
True if the time zone offset is positive, false if negative.
Header file with type definitions.