libsacio  1.0.2
Seismic Analysis Code I/O Library
Functions
timespec.c File Reference

Long duration, high precision timing. More...

Functions

char * strptime64 (const char *buf, const char *fmt, struct TM *tm, int64_t *ns)
 Parse a string into a TM value. More...
 
size_t strftime64 (char *dst, size_t n, const char *fmt, struct TM *tm, int64_t ns)
 Format a struct TM value. More...
 

Detailed Description

Long duration, high precision timing.

Function Documentation

◆ strftime64()

size_t strftime64 ( char *  dst,
size_t  n,
const char *  fmt,
struct TM *  tm,
int64_t  ns 
)

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 Name
Parameters
dstOutput character string
nLength of dst
fmtFormat for character string
tminput struct TM
nsinput nanoseconds
Returns
length of output character string, 0 on failure

◆ strptime64()

char * strptime64 ( const char *  buf,
const char *  fmt,
struct TM *  tm,
int64_t *  ns 
)

Parse a string into a TM value.

Parse a timespec64 according to the format specifiers

  • %%% character
  • %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 nanoseconds
Parameters
bufInput character string
fmtFormat to interpret the charater string
tmstruct TM to place values into
nsoutput for nanoseconds
Returns
first character not read based on the format during success, NULL on failure