|
|
|
Home / Open source / Terimber 2.0
date Class Referencedatetime up to milliseconds
More...
#include <date.h>
List of all members.
|
Public Member Functions |
| date (bool utc=false) |
| default constructor
|
| date (const char *x, size_t len=os_minus_one) |
| constructor scans narrow string format
|
| date (const wchar_t *x, size_t len=os_minus_one) |
| constructor scans wide string format
|
| date (const double *x) |
| constructor from pointer to double
|
| date (double x) |
| constructor from double
|
| date (sb8_t x) |
| constructor from ticks in milliseconds from 1 A.D.
|
| operator double () const |
| converts to double
|
| operator sb8_t () const |
| converts to ticks in milliseconds from 1 A.D.
|
bool | operator< (const date &x) const |
| less operator
|
bool | operator== (const date &x) const |
| eqaul operator
|
bool | operator!= (const date &x) const |
| non equal operator
|
bool | operator<= (const date &x) const |
| less or equal operator
|
bool | operator> (const date &x) const |
| greater operator
|
bool | operator>= (const date &x) const |
| greater or equal operator
|
bool | is_time_over (sb8_t x) const |
| checks if current time exceed the specified one
|
date & | operator+= (sb8_t interval) |
| plus assign operator
|
date & | operator-= (sb8_t interval) |
| minus assign operator
|
const char * | get_date (char *buffer) const |
| narrow string format data
|
const wchar_t * | get_date (wchar_t *buffer) const |
| wide string format data
|
const char * | get_date_only (char *buffer, const char *format) const |
| narrow string format data
|
const wchar_t * | get_date_only (wchar_t *buffer, const wchar_t *format) const |
| wide string format data
|
Static Public Member Functions |
static bool | convert_to (ub4_t year, ub1_t month, ub1_t day, ub1_t hour, ub1_t minute, ub1_t second, ub2_t millisec, sb8_t &dt) |
| converts from struct members to ticks
|
static bool | convert_from (sb8_t dt, ub4_t &year, ub1_t &month, ub1_t &day, ub1_t &hour, ub1_t &minute, ub1_t &second, ub2_t &millisec, ub1_t &wday, ub2_t &yday) |
| converts from ticks to struct members
|
static sb8_t | get_difference (sb8_t old_date) |
| gets the difference between current time and the specified one
|
Private Member Functions |
void | set_date (const char *x) |
| sets the date from formatted narrow string "%d-%02d-%02d %02d-%02d-%02d.%04d"
|
void | set_date (const wchar_t *x) |
| sets the date from formatted wide string "%d-%02d-%02d %02d-%02d-%02d.%04d"
|
void | set_double (double x) |
| sets date from double
|
Static Private Member Functions |
static bool | scan_buffer (const char *&x, size_t count, size_t delimeter_size, sb4_t &dest) |
| scans buffer of narrow chars moving pointer on count chars forward
|
static bool | scan_buffer (const wchar_t *&x, size_t count, size_t delimeter_size, sb4_t &dest) |
| scans buffer of narrow chars moving pointer on count chars forward
|
Private Attributes |
sb8_t | _ticks |
| ticks in millisecond after 1 January 0000, midnight (negative value means before)
|
Static Private Attributes |
static ub2_t | _month_days [13] |
| static array of days in month
|
static const sb8_t | _70years = 25569 |
| days in 70 years
|
static const sb8_t | _1899years = 693959 |
| days from 0 year A.D. to 12 December 1899
|
static const sb8_t | _daymillisecond = 86400000 |
| millisecond in one day
|
Detailed Description
datetime up to milliseconds
Definition at line 38 of file date.h.
Constructor & Destructor Documentation
date::date |
( |
bool |
utc = false |
) |
|
date::date |
( |
const double * |
x |
) |
|
constructor from pointer to double
- Parameters:
-
Definition at line 97 of file date.cpp.
References set_double().
constructor from ticks in milliseconds from 1 A.D.
- Parameters:
-
Definition at line 91 of file date.cpp.
References _ticks.
Member Function Documentation
date::operator double |
( |
|
) |
const |
date::operator sb8_t |
( |
|
) |
const |
converts to ticks in milliseconds from 1 A.D.
Definition at line 126 of file date.cpp.
References _ticks.
bool date::operator< |
( |
const date & |
x |
) |
const |
bool date::operator== |
( |
const date & |
x |
) |
const |
bool date::operator!= |
( |
const date & |
x |
) |
const |
bool date::operator<= |
( |
const date & |
x |
) |
const |
bool date::operator> |
( |
const date & |
x |
) |
const |
bool date::operator>= |
( |
const date & |
x |
) |
const |
greater or equal operator
Definition at line 162 of file date.cpp.
References _ticks.
bool date::is_time_over |
( |
sb8_t |
x |
) |
const |
sb8_t date::get_difference |
( |
sb8_t |
old_date |
) |
[static] |
const char * date::get_date |
( |
char * |
buffer |
) |
const |
const char * date::get_date_only |
( |
char * |
buffer, |
|
|
const char * |
format | |
|
) |
| | const |
void date::set_date |
( |
const char * |
x |
) |
[private] |
void date::set_date |
( |
const wchar_t * |
x |
) |
[private] |
bool date::scan_buffer |
( |
const char *& |
x, |
|
|
size_t |
count, |
|
|
size_t |
delimeter_size, |
|
|
sb4_t & |
dest | |
|
) |
| | [static, private] |
scans buffer of narrow chars moving pointer on count chars forward
- Parameters:
-
x |
input narrow string |
count |
chars for scan |
delimeter_size |
delimeter size |
dest |
[out] signed integer |
Definition at line 426 of file date.cpp.
References str_template::strscan().
Referenced by set_date().
bool date::scan_buffer |
( |
const wchar_t *& |
x, |
|
|
size_t |
count, |
|
|
size_t |
delimeter_size, |
|
|
sb4_t & |
dest | |
|
) |
| | [static, private] |
scans buffer of narrow chars moving pointer on count chars forward
- Parameters:
-
x |
input wide string |
count |
chars for scan |
delimeter_size |
delimeter size |
dest |
[out] signed integer |
Definition at line 439 of file date.cpp.
References str_template::strscan().
void date::set_double |
( |
double |
x |
) |
[private] |
Member Data Documentation
ticks in millisecond after 1 January 0000, midnight (negative value means before)
Definition at line 175 of file date.h.
Referenced by date(), get_date(), get_date_only(), is_time_over(), operator double(), operator sb8_t(), operator!=(), operator+=(), operator-=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), set_date(), and set_double().
Initial value:
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}
static array of days in month
Definition at line 176 of file date.h.
Referenced by convert_from(), and convert_to().
days in 70 years
Definition at line 177 of file date.h.
Referenced by date().
The documentation for this class was generated from the following files:
|
|
|
|