10#ifndef __MED__TIME__H__
11#define __MED__TIME__H__
34 vector<int> YearsMonths2Days;
35 vector<int> Years2Days;
36 vector<int> Days2Years;
37 vector<int> Days2Months;
38 vector<int> Days2Date;
39 vector<int> days2month = { 0,31,59,90,120,151,181,212,243,273,304,334,365 };
43 bool is_valid_date(
int date)
const;
57 int convert_times(
int from_type,
int to_type,
double in_time);
58 double convert_times_D(
int from_type,
int to_type,
int in_time);
59 double convert_times_D(
int from_type,
int to_type,
double in_time);
60 string convert_times_S(
int from_type,
int to_type,
int in_time);
82 int convert_years(
int to_type,
int in_time);
83 int convert_months(
int to_type,
int in_time);
84 int convert_days(
int to_type,
int in_time);
85 int convert_hours(
int to_type,
int in_time);
86 int convert_minutes(
int to_type,
int in_time);
87 int add_subtruct_days(
int in_time,
int delta_days);
95 int diff_times(
int d1,
int d2,
int in_type,
int out_type);
96 double diff_times_D(
int d1,
int type1,
int d2,
int type2,
int out_type);
97 int diff_times(
int d1,
int type1,
int d2,
int type2,
int out_type);
99 double get_age(
int t,
int type_t,
int byear);
100 double get_age_from_bdate(
int t,
int type_t,
int bdate);
110extern int global_default_time_unit;
111extern int global_default_windows_time_unit;
MedTime med_time_converter
global time converter.
Definition MedTime.cpp:10
The following is a class to handle time conversions There's a global instance of it declared below (m...
Definition MedTime.h:19
int add_subtract_time(int in_time, int in_type, int delta_time, int delta_type)
subtract time (truncating negative values)
Definition MedTime.cpp:457
static const int Minutes
minutes since 1900/01/01
Definition MedTime.h:30
static const int DateTimeString
string only format "YYYYMMDDHHMI"
Definition MedTime.h:31
int convert_datetime(int to_type, string in_time)
converts from YYYYMMDDHHMI format
Definition MedTime.cpp:173
void init_time_tables()
init of time table
Definition MedTime.cpp:39
static const int Undefined
undefined time unit
Definition MedTime.h:24
int convert_datetime_safe(int to_type, string in_time, char handle_ilegal_date=2)
converts from YYYYMMDDHHMI format include warning in dates before 1900 - for loading.
Definition MedTime.cpp:139
int convert_times(int from_type, int to_type, int in_time)
Converts time formats.
Definition MedTime.cpp:284
string type_to_string(int type)
Converts type to string.
Definition MedTime.cpp:368
static const int Days
days since 1900/01/01
Definition MedTime.h:28
static const int MIN_DATE_SUPPORT
minimal date support
Definition MedTime.h:32
static const int Years
years since 1900 (not since 0!)
Definition MedTime.h:26
static const int Hours
hours since 1900/01/01
Definition MedTime.h:29
int string_to_type(const string &str)
Convert string to type.
Definition MedTime.cpp:358
static const int Months
months since 1900/01/01
Definition MedTime.h:27
int convert_date(int to_type, int in_time)
Converts time formats from date format as input.
Definition MedTime.cpp:193
static const int Date
dates are in full regular format YYYYMMDD
Definition MedTime.h:25