21
21
#define DRIZZLED_TIME_FUNCTIONS_H
23
23
#include "drizzled/sql_error.h"
24
#include "drizzled/drizzle_time.h"
24
#include "drizzled/type/time.h"
29
typedef struct st_drizzle_time DRIZZLE_TIME;
31
28
/* Calc weekday from daynr */
32
29
/* Returns 0 for monday, 1 for tuesday .... */
33
30
int calc_weekday(long daynr, bool sunday_first_day_of_week);
60
57
Otherwise it is the last week of the previous year, and the
61
58
next week is week 1.
63
uint32_t calc_week(DRIZZLE_TIME *l_time, uint32_t week_behaviour, uint32_t *year);
60
uint32_t calc_week(type::Time *l_time, uint32_t week_behaviour, uint32_t *year);
65
62
/* Change a daynr to year, month and day */
66
63
/* Daynr 0 is returned as date 00.00.00 */
79
76
enum enum_drizzle_timestamp_type str_to_datetime_with_warn(const char *str,
85
Convert a time string to a DRIZZLE_TIME struct and produce a warning
82
Convert a time string to a type::Time struct and produce a warning
86
83
if string was cut during conversion.
89
86
See str_to_time() for more info.
91
bool str_to_time_with_warn(const char *str, uint32_t length, DRIZZLE_TIME *l_time);
88
bool str_to_time_with_warn(const char *str, uint32_t length, type::Time *l_time);
94
91
Convert a system time structure to TIME
96
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
98
void make_time(const DRIZZLE_TIME *l_time, String *str);
100
void make_date(const DRIZZLE_TIME *l_time, String *str);
102
void make_datetime(const DRIZZLE_TIME *l_time, String *str);
93
void localtime_to_TIME(type::Time *to, struct tm *from);
95
void make_time(const type::Time *l_time, String *str);
97
void make_date(const type::Time *l_time, String *str);
99
void make_datetime(const type::Time *l_time, String *str);
104
101
void make_truncated_value_warning(Session *session,
105
102
DRIZZLE_ERROR::enum_warning_level level,
126
123
This function calculates difference between l_time1 and l_time2 absolute
127
124
values. So one should set l_sign and correct result if he want to take
128
signs into account (i.e. for DRIZZLE_TIME values).
125
signs into account (i.e. for type::Time values).
131
128
Returns sign of difference.