49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
#ifndef BLUE_DS_DATETIME_H_
|
|
#define BLUE_DS_DATETIME_H_
|
|
|
|
#include <blue/core/macros.h>
|
|
#include <blue/core/status.h>
|
|
#include <ctype.h>
|
|
|
|
B_DECLS_BEGIN;
|
|
|
|
#define B_TYPE_DATETIME (b_datetime_get_type())
|
|
|
|
B_DECLARE_TYPE(b_datetime);
|
|
|
|
B_TYPE_CLASS_DECLARATION_BEGIN(b_datetime)
|
|
B_TYPE_CLASS_DECLARATION_END(b_datetime)
|
|
|
|
typedef enum b_datetime_format {
|
|
B_DATETIME_FORMAT_RFC3339 = 1,
|
|
} b_datetime_format;
|
|
|
|
BLUE_API b_type b_datetime_get_type(void);
|
|
|
|
B_TYPE_DEFAULT_CONSTRUCTOR(b_datetime, B_TYPE_DATETIME);
|
|
|
|
BLUE_API b_datetime *b_datetime_parse(b_datetime_format format, const char *s);
|
|
BLUE_API void b_datetime_to_string(
|
|
const b_datetime *dt, b_datetime_format format,
|
|
B_TYPE_FWDREF(b_stream) * dest);
|
|
|
|
BLUE_API bool b_datetime_is_localtime(const b_datetime *dt);
|
|
BLUE_API bool b_datetime_has_date(const b_datetime *dt);
|
|
BLUE_API bool b_datetime_has_time(const b_datetime *dt);
|
|
|
|
BLUE_API long b_datetime_year(const b_datetime *dt);
|
|
BLUE_API long b_datetime_month(const b_datetime *dt);
|
|
BLUE_API long b_datetime_day(const b_datetime *dt);
|
|
BLUE_API long b_datetime_hour(const b_datetime *dt);
|
|
BLUE_API long b_datetime_minute(const b_datetime *dt);
|
|
BLUE_API long b_datetime_second(const b_datetime *dt);
|
|
BLUE_API long b_datetime_subsecond(const b_datetime *dt);
|
|
|
|
BLUE_API bool b_datetime_zone_offset_is_negative(const b_datetime *dt);
|
|
BLUE_API long b_datetime_zone_offset_hour(const b_datetime *dt);
|
|
BLUE_API long b_datetime_zone_offset_minute(const b_datetime *dt);
|
|
|
|
B_DECLS_END;
|
|
|
|
#endif
|