mytime.h マニュアル

(The documentation of mytime.h)

Last update: 2023/6/12


mytime.hでは 日付・時刻を扱う関数が定義されている。
Functions to deal with date and time are defined in mytime.h.

このヘッダファイル内の関数では日付・時刻を表現するために struct humanTime型構造体(structure.h)を使用する。 C言語には日付・時刻を表現するためのstruct tm型構造体が用意されているが、
といった扱いにくい面がある。 そこで、より分かりやすい日付・時刻表現を用いるために ymaeda_opentoolsで独自に定義したのがstruct humanTime型構造体であり、 この構造体に対する様々な処理がmytime.hで定義されている。
Functions in this header file uses struct humanTime-type structure (structure.h) to express date and time. Although a built-in struct tm-type structure is available in C language, it is not convenient in that:
The struct humanTime-type structure was introduced in ymaeda_opentools to realize a more intuitive representation of date and time, and various processings for this structure are defined in mytime.h.

このヘッダファイル内で定義されている関数を以下に示す。 各関数の詳細は関数名をクリックしてリンク先を参照のこと。
Functions defined in this header file are listed below. For details of individual functions, click the links.

関数名
Function name
機能・用途
Purpose
humanTime2tm struct humanTime型構造体をstruct tm型に変換する。
Convert a struct humanTime-type structure to struct tm-type.
tm2humanTime struct tm型構造体をstruct humanTime型に変換する。
Convert a struct tm-type structure to struct humanTime-type.
humanTime2sec struct humanTime型構造体を 実数値(指定した基準日時からの経過秒数)に変換する。
Convert a struct humanTime-type structure to a real number that represents the elapsed time (sec) from a reference time specified by the user.
humanTime2sec_2000 struct humanTime型構造体を 実数値(西暦2000年1月1日0:00:00からの経過秒数)に変換する。
Convert a struct humanTime-type structure to a real number that represents the elapsed time (sec) from 0:00:00 on Jan. 1, 2000.
correct_humanTime struct humanTime型構造体を正しい値に修正する。
Correct the value of a struct humanTime-type structure.
humanTime_plus_sec struct humanTime型構造体が表す日付・時刻に指定した秒数を加算する。
Add a specified time length (s) to a date-time expressed by a struct humanTime-type structure.
timecmp 2つのstruct humanTime型構造体が表す日付・時刻の大小比較を行う。
Compare two date-times represented by struct humanTime-type structures.
timeStr2time 日付・時刻を表す文字列をstruct humanTime型構造体に変換する。
Convert strings that represent date and time to a struct humanTime-type structure.
jday2monthday 1年の先頭からの日数(julian day)を月・日に変換する。
Convert the number of days from the beginning of a year (julian day) to month and day.
calculate_jday 日付を1年の先頭からの日数(julian day)に変換する。
Convert a date to the number of days from the beginning of a year (julian day).
get_current_date_time 現在の日付・時刻を取得する。
Get the current date and time.