CppCommon  1.0.4.1
C++ Common Library
time_timezone.cpp

Timezone example

#include "time/timezone.h"
#include <iostream>
void show(const CppCommon::Timezone& time_zone)
{
std::cout << "Time.name() = " << time_zone.name() << std::endl;
std::cout << "Time.offset() = " << time_zone.offset().seconds() << std::endl;
std::cout << "Time.daylight() = " << time_zone.daylight().seconds() << std::endl;
std::cout << std::endl;
}
int main(int argc, char** argv)
{
std::cout << "UTC timezone:" << std::endl;
std::cout << "Local timezone:" << std::endl;
return 0;
}
int64_t seconds() const noexcept
Get total seconds of the current timespan.
Definition: timespan.h:138
static Timezone utc()
Get the UTC timezone (Greenwich Mean Time)
Definition: timezone.h:90
const std::string & name() const noexcept
Get timezone name.
Definition: timezone.h:60
static Timezone local()
Get the local timezone.
Definition: timezone.h:99
const Timespan & daylight() const noexcept
Get timezone daylight saving time offset.
Definition: timezone.h:64
const Timespan & offset() const noexcept
Get timezone offset.
Definition: timezone.h:62
Timezone definition.