![]()  | 
  
    Disk ARchive 2.8.1
    
   Full featured and portable backup and archiving tool 
   | 
 
stores time information More...
#include <datetime.hpp>
 Collaboration diagram for libdar::datetime:Public Types | |
| enum | time_unit { tu_nanosecond , tu_microsecond , tu_second } | 
Public Member Functions | |
| datetime (const infinint &value=0) | |
| constructor based on the number of second ellasped since the end of 1969  More... | |
| datetime (time_t second, time_t subsec, time_unit unit) | |
| general constructor  More... | |
| datetime (generic_file &x, archive_version ver) | |
| constructor reading data dump() into a generic_file  | |
| datetime (const datetime &ref)=default | |
| datetime (datetime &&ref) noexcept=default | |
| datetime & | operator= (const datetime &ref)=default | 
| datetime & | operator= (datetime &&ref) noexcept=default | 
| bool | operator< (const datetime &ref) const | 
| bool | operator== (const datetime &ref) const | 
| bool | operator!= (const datetime &ref) const | 
| bool | operator>= (const datetime &ref) const | 
| bool | operator> (const datetime &ref) const | 
| bool | operator<= (const datetime &ref) const | 
| void | operator-= (const datetime &ref) | 
| void | operator+= (const datetime &ref) | 
| datetime | operator- (const datetime &ref) const | 
| datetime | operator+ (const datetime &ref) const | 
| bool | loose_equal (const datetime &ref) const | 
| equivalent to operator == but if compared object use different time unit, do the comparison rounding up the values to the largest unit  | |
| datetime | loose_diff (const datetime &ref) const | 
| at the difference of operator - provides the difference using the less precise unit used between the two elements  | |
| infinint | get_second_value () const | 
| return the integer number of second  More... | |
| infinint | get_subsecond_value (time_unit unit) const | 
| return the subsecond time fraction expressed in the given time unit  | |
| time_unit | get_unit () const | 
| returns the time unit used internally to store the subsecond time fraction  More... | |
| bool | get_value (time_t &second, time_t &subsecond, time_unit unit) const | 
| return a time as time_t arguments  More... | |
| void | dump (generic_file &x) const | 
| write down this to file  | |
| void | read (generic_file &f, archive_version ver) | 
| read this from file  | |
| bool | is_null () const | 
| return true if the datetime is exactly January 1st, 1970, 0 h 0 mn 0 s  More... | |
| bool | is_integer_second () const | 
| return true if the datetime is an integer number of second (subsecond part is zero)  More... | |
| infinint | get_storage_size () const | 
| return the storage it would require to dump this object  | |
| void | nullify () | 
| set to null (zero)  More... | |
Static Public Member Functions | |
| static std::string | unit_symbol (time_unit tu) | 
| return the SI symbol of the time unit (s, ms, us (should be mu greek letter), ns)  | |
Private Member Functions | |
| void | reduce_to_largest_unit () const | 
| reduce the value to the largest unit possible  | |
| void | get_value (infinint &sec, infinint &sub, time_unit unit) const | 
| void | build (const infinint &sec, const infinint &sub, time_unit unit) | 
Static Private Member Functions | |
| static time_unit | min (time_unit a, time_unit b) | 
| static time_unit | max (time_unit a, time_unit b) | 
| static char | time_unit_to_char (time_unit a) | 
| static time_unit | char_to_time_unit (const char a) | 
| static const infinint & | get_scaling_factor (time_unit source, time_unit dest) | 
| return the factor between two units  More... | |
Private Attributes | |
| infinint | val | 
| the date expressed in the "uni" time unit  More... | |
| time_unit | uni | 
| the time unit used to store the subsecond fraction of the timestamp.  More... | |
stores time information
Definition at line 58 of file datetime.hpp.
| enum libdar::datetime::time_unit | 
Definition at line 63 of file datetime.hpp.
      
  | 
  inline | 
constructor based on the number of second ellasped since the end of 1969
Definition at line 66 of file datetime.hpp.
| libdar::datetime::datetime | ( | time_t | second, | 
| time_t | subsec, | ||
| time_unit | unit | ||
| ) | 
general constructor
| [in] | second | the number of second since the dawn of computer time (1970) | 
| [in] | subsec | the fraction of the time below 1 second expressed in the time unit given as next argument | 
| [in] | unit | the time unit in which is expressed the previous argument | 
      
  | 
  staticprivate | 
return the factor between two units
      
  | 
  inline | 
return the integer number of second
Definition at line 107 of file datetime.hpp.
References get_value(), and uni.
      
  | 
  inline | 
returns the time unit used internally to store the subsecond time fraction
Definition at line 113 of file datetime.hpp.
References uni.
| bool libdar::datetime::get_value | ( | time_t & | second, | 
| time_t & | subsecond, | ||
| time_unit | unit | ||
| ) | const | 
return a time as time_t arguments
| [out] | second | the time value in second | 
| [out] | subsecond | is the remaining time fraction as expressed in the unit given as next argument | 
| [in] | unit | the unit of the subsecond fraction of the timestamp | 
Referenced by libdar::list_entry::get_last_access(), libdar::list_entry::get_last_change(), libdar::list_entry::get_last_modif(), and get_second_value().
      
  | 
  inline | 
return true if the datetime is an integer number of second (subsecond part is zero)
Definition at line 134 of file datetime.hpp.
References uni.
      
  | 
  inline | 
return true if the datetime is exactly January 1st, 1970, 0 h 0 mn 0 s
Definition at line 131 of file datetime.hpp.
References libdar::infinint::is_zero(), and val.
      
  | 
  inline | 
      
  | 
  inline | 
Definition at line 89 of file datetime.hpp.
Definition at line 98 of file datetime.hpp.
Definition at line 97 of file datetime.hpp.
      
  | 
  inline | 
Definition at line 92 of file datetime.hpp.
      
  | 
  inline | 
Definition at line 91 of file datetime.hpp.
      
  | 
  inline | 
Definition at line 90 of file datetime.hpp.
      
  | 
  private | 
the time unit used to store the subsecond fraction of the timestamp.
Definition at line 153 of file datetime.hpp.
Referenced by datetime(), get_second_value(), get_unit(), is_integer_second(), and nullify().
      
  | 
  private | 
the date expressed in the "uni" time unit
Definition at line 152 of file datetime.hpp.
Referenced by datetime(), is_null(), and nullify().