Giter Club home page Giter Club logo

ggdatetime's Introduction

C++ Datetime library

Introduction

ggdatetime is a C++ library to assist date and time related computations in Geodesy related fields.

CI test clang-format Check Linux CI build

Compilation / Installation

Source code is ISO C++17. Compilation should be trivial using any C++ compiler supporting the c++17 standard (option -std=c++17 in gcc and clang).

October 2021 Source code can also be compiled using the latest C++ 20 standard.

Since December 2021, the build system has been changed from GNU Autotools to scons.

Compile and install

To compile and install, using scons, just type:

# compile
scons
# install (system-wide)
sudo scons install

Examples

Consult the test programs source code in the test folder for examples on how to use the library.

Developers

Take a look at the LLVM Coding Standards and if possible stick to it.

Use clang-format to format you code before commiting; if you try to commit with non-acceptable code format, the CI system will fail.

Testing

Test source code is found in test folder. To automatically run all tests, use the Python script run_test_suite.py. Note that to be able to run the scipt, you will have to compile using the test=1 option, i.e.

## build project and tests
scons test=1
## run tests
./run_test_suite.py --progs-dir=test

The Library

Nomenclature

  • Julian year 365.25 days
  • Julian century 36525 days

Julian date (JD) is a continuous count of days (JD zero is located about 7000 years ago). Because of the unwieldy size of Julian Dates and the awkwardness of the half-day offset, it is accepted practice to remove the leading ‘24’ and the trailing ‘.5’, producing what is called the Modified Julian Date, i.e. $ MJD = JD − 2,400,000.5 $

In the library, this constant is named ds::MJD0_JD = 2400000.5e0, i.e. the Julian Date of Modified Julian Date zero.

Julian epoch is a convinient way of representing an epoch as fractional years. It uses the Julian year of exactly 365.25 days, and the TT time scale; Julian epoch 2000.0 is defined to be 2000 January 1.5 (i.e. 2000 January 1d 12h), which is JD 2,451,545.0 (i.e. dso::J2000_JD) or MJD 51,544.5 (i.e. dso::J2000_MJD). Julian epoch is usually denoted as “J2000.0”.

Precision

Transforming from datetime<T> to TwoPartDates

Transforming from a datetime<nanoseconds> instance to an instance of type TwoPartDate preserves a precision better than 2e-2 nanoseconds. This is verified by running the test program unit_tests/tpdates1.cpp

Transforming from a datetime<microseconds> instance to an instance of type TwoPartDate preserves a precision better than 2e-5 microseconds. This is verified by running the test program unit_tests/tpdates2.cpp

Transforming from a datetime<milliseconds> instance to an instance of type TwoPartDate preserves a precision better than 2e-8 milliseconds. This is verified by running the test program unit_tests/tpdates3.cpp

Transforming from a datetime<seconds> instance to an instance of type TwoPartDate preserves a precision better than 2e-12 seconds. This is verified by running the test program unit_tests/tpdates4.cpp

Transforming from/to Julian Epoch

Transforming from a TwoPartDate to a Julian Epoch and back, preserves an accuracy of ~1e-5 seconds. This is verified by running the test program test/sofa/epj_date.cpp.

ggdatetime's People

Contributors

xanthospap avatar naturalneuralnet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.