GadgetSeed
0.9.6
|
日付時刻 [詳解]
#include "timer.h"
データ構造 | |
struct | st_datetime |
時刻構造体 [詳解] | |
struct | st_systime |
システム時間 [詳解] | |
マクロ定義 | |
#define | GSC_TIMEZONE_STR "JST" |
$gsc タイムゾーンを示す文字列 | |
#define | GSC_DIFF_FROM_LOCAL_TIME_SEC (9*60*60) |
$gsc UTCと日本時間(+9時間)との時差(秒) | |
#define | DATE_STR_LEN ((unsigned int)sizeof("YYYY/MM/DD WWW")) |
#define | TIME_STR_LEN ((unsigned int)sizeof("HH/MM/SS")) |
#define | MSEC_STR_LEN ((unsigned int)sizeof(".mmm")) |
#define | DATETIME_STR_LEN (DATE_STR_LEN + 1 + TIME_STR_LEN) |
#define | DATEMTIME_STR_LEN (DATE_STR_LEN + 1 + TIME_STR_LEN + 1 + MSEC_STR_LEN) |
型定義 | |
typedef long long int | t_time |
関数 | |
int | read_rtc_time (struct st_datetime *datetime) |
void | datetime_to_str (char *str, struct st_datetime *datetime) |
時間を日付時間文字列に変換する [詳解] | |
void | datemtime_to_str (char *str, struct st_datetime *datetime) |
時間を日付ミリ秒時間文字列に変換する [詳解] | |
void | date_to_str (char *str, struct st_datetime *datetime) |
時間を日付文字列に変換する [詳解] | |
void | mtime_to_str (char *str, struct st_datetime *datetime) |
時間をミリ秒時間文字列に変換する [詳解] | |
void | time_to_str (char *str, struct st_datetime *datetime) |
時間を時間文字列に変換する [詳解] | |
int | set_rtc (struct st_datetime *datetime) |
int | init_time (char *devname) |
時計を初期する [詳解] | |
char | date_to_dayofweek (short year, char month, char day) |
西暦年、月、日より曜日を求める [詳解] | |
int | is_leap_year (int year) |
うるう年か調べる [詳解] | |
int | num_of_day_in_month (int year, int month) |
うるう月か調べる [詳解] | |
void | unixtime_to_datetime (struct st_datetime *datetime, struct st_systime *unixtime) |
UNIX時間より時刻を求める [詳解] | |
void | systime_to_datetime (struct st_datetime *datetime, struct st_systime *stime) |
システム時間よりローカル時刻を求める [詳解] | |
t_time | datetime_to_utc (struct st_datetime *datetime) |
ローカル西暦年月日、時間よりUTCを求める [詳解] | |
void | datetime_to_systime (struct st_systime *systime, struct st_datetime *time) |
ローカル西暦年月日、時間よりシステム時間を求める [詳解] | |
void | set_systime (struct st_systime *systime) |
UTC時刻からシステム時間を設定する [詳解] | |
t_time | get_systime_sec (void) |
システム時間(秒)を取得する [詳解] | |
unsigned int | fattime (void) |
FAT 現在実時間を取得する [詳解] | |
void | get_systime (struct st_systime *systime) |
システム時間を取得する [詳解] | |
void | register_sec_timer_func (timer_func func) |
時刻秒更新に同期した1秒周期処理を登録する [詳解] | |
void | sync_systime_from_rtc (void) |
void | adjust_systime (void) |
void | sync_rtc_from_systime (void) |
変数 | |
struct st_systime | system_time |
struct st_systime | l_system_time |
timer_func | sec_timer_func |
1秒間隔処理関数 | |
char date_to_dayofweek | ( | short | year, |
char | month, | ||
char | day | ||
) |
西暦年、月、日より曜日を求める
[out] | year | 西暦年 |
[out] | month | 月 |
[out] | day | 日 |
datetime.c の 594 行目に定義があります。
void date_to_str | ( | char * | str, |
struct st_datetime * | time | ||
) |
void datemtime_to_str | ( | char * | str, |
struct st_datetime * | time | ||
) |
void datetime_to_str | ( | char * | str, |
struct st_datetime * | time | ||
) |
void datetime_to_systime | ( | struct st_systime * | systime, |
struct st_datetime * | datetime | ||
) |
ローカル西暦年月日、時間よりシステム時間を求める
1970/01/01 00:00:00 が 0 になる
[out] | systime | システム時間 |
[in] | datetime | 西暦年月日、時間 |
datetime.c の 736 行目に定義があります。
t_time datetime_to_utc | ( | struct st_datetime * | datetime | ) |
ローカル西暦年月日、時間よりUTCを求める
UTC 1970/01/01 00:00:00 が 0 になる JST 1970/01/01 09:00:00 が 0 になる
[in] | datetime | 西暦年月日、時間 |
datetime.c の 704 行目に定義があります。
unsigned int fattime | ( | void | ) |
FAT 現在実時間を取得する
datetime.c の 775 行目に定義があります。
参照先 st_datetime::day, get_systime(), st_datetime::hour, st_datetime::min, st_datetime::month, st_datetime::sec, systime_to_datetime(), st_datetime::year.
void get_systime | ( | struct st_systime * | systime | ) |
システム時間を取得する
[out] | システム時間 |
datetime.c の 802 行目に定義があります。
参照先 st_systime::sec, system_time, st_systime::usec.
参照元 fattime().
t_time get_systime_sec | ( | void | ) |
int init_time | ( | char * | devname | ) |
時計を初期する
時間をリアルタイムクロックより読み出し設定する
[in] | devname | RTCデバイス名 |
リアルタイムクロックが無いシステムでは"0"を設定する
datetime.c の 517 行目に定義があります。
int is_leap_year | ( | int | year | ) |
void mtime_to_str | ( | char * | str, |
struct st_datetime * | time | ||
) |
int num_of_day_in_month | ( | int | year, |
int | month | ||
) |
void register_sec_timer_func | ( | timer_func | func | ) |
void set_systime | ( | struct st_systime * | systime | ) |
void systime_to_datetime | ( | struct st_datetime * | datetime, |
struct st_systime * | stime | ||
) |
システム時間よりローカル時刻を求める
[out] | datetime | 時刻(ローカル) |
[in] | time | システム時間 |
datetime.c の 684 行目に定義があります。
参照元 fattime().
void time_to_str | ( | char * | str, |
struct st_datetime * | time | ||
) |
void unixtime_to_datetime | ( | struct st_datetime * | datetime, |
struct st_systime * | unixtime | ||
) |
struct st_systime system_time |
システム時間(UNIX時間、UTC) 1970/01/01 00:00:00 からの1秒カウン タ(2038年問題非対応)
datetime.c の 129 行目に定義があります。