関数timecmp マニュアル

(The documentation of function timecmp)

Last Update: 2023/4/7


◆機能・用途(Purpose)

2つのstruct humanTime型構造体が表す日付・時刻の大小比較を行う。
Compare two date-times represented by struct humanTime-type structures.


◆形式(Format)

#include <mytime.h>
inline int timecmp (const struct humanTime time1,const struct humanTime time2)


◆引数(Arguments)

time1 比較したい1つ目の日付・時刻。
The first date and time to compare.
time2 比較したい2つ目の日付・時刻。
The second date and time to compare.


◆戻り値(Return value)



◆使用例(Example)

struct humanTime date_st={2019,1,1,0,0,0.0};
struct humanTime date_en={2022,12,31,0,0,0.0};
struct humanTime date_loop;
for(date_loop=date_st; timecmp(date_loop,date_en)<=0; date_loop=humanTime_plus_sec(date_loop,86400.0)){
    処理 (Processings) ;
}

この例では変数date_loopを 2019/01/01 00:00:00から2022/12/31 00:00:00まで 1日(86400秒)ずつずらしながらループ処理を行う。
In this example, a loop-based processing is performed with variable date_loop, which varies from 2019/01/01 00:00:00 to 2022/12/31 00:00:00 at increments of 1 day (86400 s).