CppCommon  1.0.4.1
C++ Common Library
time_timespan.cpp

Timespan example

#include "time/timespan.h"
#include <iostream>
#include <string>
int main(int argc, char** argv)
{
std::cout << "Please enter timespan milliseconds as an integer number..." << std::endl;
std::string line;
getline(std::cin, line);
int milliseconds = std::stoi(line);
std::cout << "Timespan.days() = " << timespan.days() << std::endl;
std::cout << "Timespan.hours() = " << (timespan.hours() % 24) << std::endl;
std::cout << "Timespan.minutes() = " << (timespan.minutes() % 60) << std::endl;
std::cout << "Timespan.seconds() = " << (timespan.seconds() % 60) << std::endl;
std::cout << "Timespan.milliseconds() = " << (timespan.milliseconds() % 1000) << std::endl;
return 0;
}
int64_t seconds() const noexcept
Get total seconds of the current timespan.
Definition: timespan.h:138
int64_t days() const noexcept
Get total days of the current timespan.
Definition: timespan.h:129
int64_t milliseconds() const noexcept
Get total milliseconds of the current timespan.
Definition: timespan.h:141
int64_t minutes() const noexcept
Get total minutes of the current timespan.
Definition: timespan.h:135
int64_t hours() const noexcept
Get total hours of the current timespan.
Definition: timespan.h:132
Timespan definition.