関数humanTime_plus_sec マニュアル

(The documentation of function humanTime_plus_sec)

Last Update: 2023/4/7


◆機能・用途(Purpose)

struct humanTime型構造体が表す日付・時刻に指定した秒数を加算する。
Add a specified time length (s) to a date-time expressed by a struct humanTime-type structure.


◆形式(Format)

#include <mytime.h>
inline struct humanTime humanTime_plus_sec
(const struct humanTime original,const double sec)


◆引数(Arguments)

original 元々の日付・時刻。
The original date and time.
sec 加算する秒数。
The time length (s) to be added.


◆戻り値(Return value)

引数originalが表す日付・時刻のsec秒後の日付・時刻を表す構造体。
A structure that represents a date and time that is sec s later than the date and time expressed by the argument original.


◆使用例(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).