libsacio
1.0.2
Seismic Analysis Code I/O Library
|
Long duration, high precision time manipulation. More...
Data Structures | |
struct | timespec64 |
High-precision, long duration time value. More... | |
struct | duration |
time duration with units More... | |
Enumerations | |
enum | TimeType { Duration_None = 0, Duration_Seconds = 1, Duration_Minutes = 2, Duration_Hours = 3, Duration_Days = 4, Duration_Weeks = 5, Duration_Months = 6, Duration_Years = 7, Duration_Decades = 8, Duration_Centuries = 9 } |
duration units | |
Functions | |
timespec64 | timespec64::timespec64_now () |
Get now as a timespec64 value. More... | |
timespec64 | timespec64::timespec64_undef () |
Get the time associated with Year 0, Day 1. More... | |
timespec64 | timespec64::timespec64_from_yjhmsf (int64_t year, int jday, int hour, int min, int sec, int64_t ns) |
Create a timespec64 value from Year, Day of Year, Hour, Minute, Second, Nanosecond. More... | |
timespec64 | timespec64::timespec64_from_ymdhmsf (int64_t year, int month, int day, int hour, int min, int sec, int64_t ns) |
Create a timespec64 value from Year, Month, Day, Hour, Minute, Second, Nanosecond. More... | |
int | timespec64::timespec64_parse (const char *buf, timespec64 *t) |
Parse a string into a timespec64 value. More... | |
void | timespec64::timespec64_print (timespec64 *t) |
Print out a timespec64 value. More... | |
timespec64 | timespec64::timespec64_add_duration (timespec64 a, duration *d) |
Add a duration to a timespec64. More... | |
int | timespec64::timespec64_cmp (timespec64 *a, timespec64 *b) |
Compare two timespec64 values. More... | |
char * | timespec64::strptime64t (const char *buf, const char *fmt, timespec64 *t) |
Parse a string into a timespec64 value. More... | |
size_t | timespec64::strftime64t (char *dst, size_t n, const char *fmt, timespec64 *t) |
Format a struct TM value. More... | |
void | duration::duration_init (duration *d) |
Initialize a duration. More... | |
int | duration::duration_parse (char *in, duration *d) |
Parse a string into a duration. More... | |
duration * | duration::duration_from_string (char *in) |
Create a duration from a character stirng. More... | |
void | timespec64::timespec64_to_ymd (timespec64 *t, int64_t *year, int *month, int *day, int *oday) |
Get dates values from timespec64. More... | |
Long duration, high precision time manipulation.
duration * duration_from_string | ( | char * | in | ) |
void duration_init | ( | duration * | d | ) |
Initialize a duration.
d | duration to initialize |
int duration_parse | ( | char * | in, |
duration * | d | ||
) |
Parse a string into a duration.
in | character string to parse |
d | duration output from string |
Format for a duration is [-+]###{unit}
where:
###
is a integer{unit}
is one of the followingsize_t strftime64t | ( | char * | dst, |
size_t | n, | ||
const char * | fmt, | ||
timespec64 * | t | ||
) |
Format a struct TM value.
Format a timespec64 according to the format specifiers
%%
– %
character%Y
– Year, 4 digits, zero padded%j
– Day of the year, 3 digits, zero padded%m
– Month number, 2 digits, zero padded%d
– Day of the month, 2 digits, zero padded%H
– Hour, 2 digits, zero padded%M
– Minute, 2 digits, zero padded%S
– Seconds, 2 digits, zero padded%f
– partial seconds as nanoseconds, prefix digit defines the number of leading digits to show%F
– alias for %Y-%m-%d
%T
– alias for %H:%M:%S
%b
– Abbreviated Month Namedst | Output character string |
n | Length of dst |
fmt | Format for character string |
t | input timespec64 value |
char * strptime64t | ( | const char * | buf, |
const char * | fmt, | ||
timespec64 * | t | ||
) |
Parse a string into a timespec64 value.
Parse a timespec64 according to the format specifiers
%%
– %
characters%Y
– Year%j
– Day of the year, 1-366%m
– Month number, 1-12%d
– Day of the month, 1-31%H
– Hour, 0-23%M
– Minute, 0-59%S
– Seconds, 0-60%f
– partial seconds as nanosecondsbuf | Input character string |
fmt | Format to interpret the charater string |
t | output timespec64 value to place values into |
timespec64 timespec64_add_duration | ( | timespec64 | a, |
duration * | d | ||
) |
Add a duration to a timespec64.
a | timespec64 value |
d | duration to add to to timespec64 |
int timespec64_cmp | ( | timespec64 * | a, |
timespec64 * | b | ||
) |
Compare two timespec64 values.
a | First timespec64 value |
b | Second timespec64 value |
timespec64 timespec64_from_yjhmsf | ( | int64_t | year, |
int | jday, | ||
int | hour, | ||
int | min, | ||
int | sec, | ||
int64_t | ns | ||
) |
Create a timespec64 value from Year, Day of Year, Hour, Minute, Second, Nanosecond.
year | Year |
jday | Day of the year |
hour | Hour |
min | Minute |
sec | Second |
ns | Nanosecond |
timespec64 timespec64_from_ymdhmsf | ( | int64_t | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | min, | ||
int | sec, | ||
int64_t | ns | ||
) |
Create a timespec64 value from Year, Month, Day, Hour, Minute, Second, Nanosecond.
year | Year |
month | Month |
day | Month Day |
hour | Hour |
min | Minute |
sec | Second |
ns | Nanosecond |
timespec64 timespec64_now | ( | ) |
Get now as a timespec64 value.
int timespec64_parse | ( | const char * | buf, |
timespec64 * | t | ||
) |
Parse a string into a timespec64 value.
buf | Input character string |
t | timespec64 value to parse into |
void timespec64_print | ( | timespec64 * | t | ) |
Print out a timespec64 value.
t | timespec64 |
void timespec64_to_ymd | ( | timespec64 * | t, |
int64_t * | year, | ||
int * | month, | ||
int * | day, | ||
int * | oday | ||
) |
Get dates values from timespec64.
Get year, month, day and day of the year from a timespec64 value
t | input timespec64 value |
year | output year |
month | output month |
day | output day of the month |
oday | output day of the year |
timespec64 timespec64_undef | ( | ) |
Get the time associated with Year 0, Day 1.
Get the time associated with non-existant Year 0, Day 1. It is used as a constant for an uninitialized value. This year does not exist, but is actaully 1 BC. See Year zero. The value returned may change in the future.