|
GadgetSeed
0.9.6
|
日付時刻 [詳解]
#include "sysconfig.h"#include "datetime.h"#include "timer.h"#include "device.h"#include "device/rtc_ioctl.h"#include "tprintf.h"#include "tkprintf.h"#include "dkprintf.h"
マクロ定義 | |
| #define | DEF_SYSTIME_INC_COUNT (1000 * GSC_KERNEL_TIMER_INTERVAL_MSEC) |
| システム時間カーネルタイマ間隔増加分 | |
列挙型 | |
| enum | tsync_status { TSYNC_NONE, TSYNC_SYNC, TSYNC_ADJUST } |
関数 | |
| static void | time_count_proc (void *sp, unsigned long long ktime) |
| システムタイマ定期処理タイマ関数 [詳解] | |
| void | date_to_str (char *str, struct st_datetime *time) |
| 時間を日付文字列に変換する [詳解] | |
| void | time_to_str (char *str, struct st_datetime *time) |
| 時間を時間文字列に変換する [詳解] | |
| void | mtime_to_str (char *str, struct st_datetime *time) |
| 時間をミリ秒時間文字列に変換する [詳解] | |
| void | datetime_to_str (char *str, struct st_datetime *time) |
| 時間を日付時間文字列に変換する [詳解] | |
| void | datemtime_to_str (char *str, struct st_datetime *time) |
| 時間を日付ミリ秒時間文字列に変換する [詳解] | |
| int | init_time (char *devname) |
| 時計を初期する [詳解] | |
| static void | jd2greg (int jd, short *year, char *month, char *day) |
| 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 *datetime) |
| ローカル西暦年月日、時間よりシステム時間を求める [詳解] | |
| 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秒周期処理を登録する [詳解] | |
変数 | |
| struct st_systime | system_time |
| struct st_systime | l_system_time |
| static int | systime_inc_count = DEF_SYSTIME_INC_COUNT |
| static enum tsync_status | tsync_status |
| timer_func | sec_timer_func = 0 |
| 1秒間隔処理関数 | |
| static const char | weekname [7][10] |
| 曜日文字列 [詳解] | |
日付時刻
GadgetSeed の時計はカーネルタイマよりカウントされます。 システム起動時に最初にRTCデバイスより同期を行います。 RTCはUTC時刻が設定されます。
datetime.c に定義があります。
| 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().

|
static |
| 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 行目に定義があります。
|
static |
曜日文字列
datetime.c の 379 行目に定義があります。