thegeorg 0c31d97afd Sync linux-headers instead of using system ones 1 year ago
..
ut 094638589d intermediate changes 2 years ago
CMakeLists.darwin.txt 0c31d97afd Sync linux-headers instead of using system ones 1 year ago
CMakeLists.linux-aarch64.txt 0c31d97afd Sync linux-headers instead of using system ones 1 year ago
CMakeLists.linux.txt 0c31d97afd Sync linux-headers instead of using system ones 1 year ago
CMakeLists.txt 0c31d97afd Sync linux-headers instead of using system ones 1 year ago
README.md 59aca5c518 Restoring authorship annotation for Ivan Komarov <Ivan.Komarov@dfyz.info>. Commit 2 of 2. 2 years ago
civil-inl.h b3c1a08629 Restoring authorship annotation for <gotmanov@yandex-team.ru>. Commit 2 of 2. 2 years ago
civil.cpp d6a9908bd3 Restoring authorship annotation for <barricade@yandex-team.ru>. Commit 2 of 2. 2 years ago
civil.h 28b5151b6d Restoring authorship annotation for <yulika@yandex-team.ru>. Commit 2 of 2. 2 years ago
convert.cpp 1fe4b402b3 Restoring authorship annotation for <petrk@yandex-team.ru>. Commit 2 of 2. 2 years ago
convert.h 1fe4b402b3 Restoring authorship annotation for <petrk@yandex-team.ru>. Commit 2 of 2. 2 years ago

README.md

A library for translating between absolute times (i.e., TInstant) and civil times (i.e., NDatetime::TSimpleTM) using the rules defined by a time zone (i.e., NDatetime::TTimeZone).

(the terms absolute and civil come from cctz#fundamental-concepts)

This is basically a wrapper around CCTZ with one important change: the time zone database is in Arcadia and is compiled with the library (which means your executable will end up ~2MB larger).

See contrib/libs/cctz/README if you think zone database is outdated.

Quick start:

#include <library/cpp/timezone_conversion/convert.h>

// NDatetime::{GetLocalTimeZone(),GetUtcTimeZone()} are also available.
NDatetime::TTimeZone msk = NDatetime::GetTimeZone("Europe/Moscow");
TInstant now = TInstant::Now();
NDatetime::TSimpleTM civil = NDatetime::ToCivilTime(now, msk);
Cout << "Local time in Moscow is " << civil.ToString() << Endl;
TInstant absolute = NDatetime::ToAbsoluteTime(civil, msk);
Cout << "The current UNIX time is " << absolute.Seconds() << Endl;