32 #include <sys/types.h>
45 #include "../my_config.h"
54 class archive_version;
63 enum time_unit { tu_nanosecond, tu_microsecond, tu_second };
73 datetime(time_t second, time_t subsec, time_unit unit);
87 bool operator < (
const datetime & ref)
const;
88 bool operator == (
const datetime & ref)
const;
89 bool operator != (
const datetime & ref)
const {
return ! (*
this == ref); };
90 bool operator >= (
const datetime & ref)
const {
return ! (*
this < ref); };
91 bool operator > (
const datetime & ref)
const {
return ref < *
this; };
92 bool operator <= (
const datetime & ref)
const {
return ref >= *
this; };
95 void operator -= (
const datetime & ref);
96 void operator += (
const datetime & ref);
121 bool get_value(time_t & second, time_t & subsecond, time_unit unit)
const;
140 void nullify() { val = 0; uni = tu_second ; };
157 static time_unit min(time_unit a, time_unit b);
158 static time_unit max(time_unit a, time_unit b);
159 static char time_unit_to_char(time_unit a);
160 static time_unit char_to_time_unit(
const char a);
class archive_version manages the version of the archive format
bool loose_equal(const datetime &ref) const
equivalent to operator == but if compared object use different time unit, do the comparison rounding ...
bool get_value(time_t &second, time_t &subsecond, time_unit unit) const
return a time as time_t arguments
void dump(generic_file &x) const
write down this to file
infinint get_subsecond_value(time_unit unit) const
return the subsecond time fraction expressed in the given time unit
void read(generic_file &f, archive_version ver)
read this from file
static const infinint & get_scaling_factor(time_unit source, time_unit dest)
return the factor between two units
infinint get_storage_size() const
return the storage it would require to dump this object
datetime(generic_file &x, archive_version ver)
constructor reading data dump() into a generic_file
time_unit get_unit() const
returns the time unit used internally to store the subsecond time fraction
void nullify()
set to null (zero)
void reduce_to_largest_unit() const
reduce the value to the largest unit possible
datetime(time_t second, time_t subsec, time_unit unit)
general constructor
datetime(const infinint &value=0)
constructor based on the number of second ellasped since the end of 1969
bool is_integer_second() const
return true if the datetime is an integer number of second (subsecond part is zero)
datetime loose_diff(const datetime &ref) const
at the difference of operator - provides the difference using the less precise unit used between the ...
bool is_null() const
return true if the datetime is exactly January 1st, 1970, 0 h 0 mn 0 s
infinint get_second_value() const
return the integer number of second
this is the interface class from which all other data transfer classes inherit
the arbitrary large positive integer class
archive_version db2archive_version(unsigned char db_version)
converts dar_manager database version to dar archive version in order to properly read time fields
switch module to limitint (32 ou 64 bits integers) or infinint
libdar namespace encapsulate all libdar symbols