(The documentation of function humanTime2sacIndex)
Last Update: 2023/6/12
◆機能・用途(Purpose)
struct humanTime型構造体で表された絶対日時を
SAC時系列データ内でのサンプル番号
(struct sac_timeseq型構造体のメンバdata.valueの配列要素番号)
に変換する。
Convert an absolute date and time,
expressed by a struct humanTime-type structure,
to a sample index in a SAC time series data
(i.e., an index of array of member data.value
of a struct sac_timeseq-type structure).
◆形式(Format)
#include <sac/convert.h>
inline int humanTime2sacIndex
(union sacheader header,struct humanTime time_specified)
◆引数(Arguments)
header
SACヘッダ。
A SAC header.
time_specified
変換したい時刻。
The time to convert.
◆戻り値(Return value)
引数headerで指定されたヘッダを持つSACデータの
先頭時刻を、サンプリング間隔を、
引数time_specifiedが表す時刻をとして、
を満たす整数。
この式を満たすが整数でない場合はプログラムをエラー終了する。
The integer that satisfies ,
where and are
the beginning time and sampling interval, respectively,
of the SAC data that has the headers
specified by argument header,
and is the time specified by argument time_specified.
If the value of that satisfies this relation is not an integer,
the program finishes as an error.
◆使用例(Example)
struct sac_timeseq sacdata
=read_sac_timeseq("20140102_0345_1min_100Hz.sac");
struct humanTime timevalue={2014,1,2,3,45,6.78};
int index=humanTime2sacIndex(sacdata.header,timevalue);
この例において、20140102_0345_1min_100Hz.sacは
2014/01/02 03:45:00からの1分間のSAC時系列データ(100 Hzサンプリング)
であるものとする。
この場合、上の例ではindex=678となる。
Suppose that 20140102_0345_1min_100Hz.sac in this example
is a SAC time series data of 100 Hz sampling
that begins at 03:45:00 on January 2, 2014.
Then this example gives index=678.