File: format.h

package info (click to toggle)
martchus-cpp-utilities 5.33.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,396 kB
  • sloc: cpp: 12,679; awk: 18; ansic: 12; makefile: 10
file content (29 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef CHRONO_FORMAT_H
#define CHRONO_FORMAT_H

#include "./datetime.h"
#include "./period.h"

#include <ostream>

inline std::ostream &operator<<(std::ostream &out, const CppUtilities::DateTime &value)
{
    return out << value.toString(CppUtilities::DateTimeOutputFormat::DateAndTime, false);
}

inline std::ostream &operator<<(std::ostream &out, const CppUtilities::DateTimeExpression &value)
{
    return out << value.toIsoString();
}

inline std::ostream &operator<<(std::ostream &out, const CppUtilities::TimeSpan &value)
{
    return out << value.toString(CppUtilities::TimeSpanOutputFormat::Normal, false);
}

inline std::ostream &operator<<(std::ostream &out, const CppUtilities::Period &value)
{
    return out << value.years() << " years, " << value.months() << " months, " << value.days() << " days";
}

#endif // CHRONO_FORMAT_H