TimeValue

Export type for specifing a time value.

The time value can be either an absolute point in time or a positive relative time offset.

Summary
TimeValueExport type for specifing a time value.
CopyrightThis program is free software.
Files
C-kern/api/time/timevalue.hHeader file TimeValue.
Types
struct timevalue_tExports timevalue_t.
timevalue_tThe time value specifies either an aboslute time or a relative time offset.
secondsThe seconds counted from some point in time.
nanosecThe nano seconds counted from some point in time.
lifetime
timevalue_INITStatic initializer.
query
isvalid_timevalueReturns true if tv contains a valid value.
diffms_timevalue
inline implementation
Macros
isvalid_timevalueImplements timevalue_t.isvalid_timevalue.
diffms_timevalueImplements timevalue_t.diffms_timevalue.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/time/timevalue.h

Header file TimeValue.

Types

struct timevalue_t

typedef struct timevalue_t timevalue_t

Exports timevalue_t.

timevalue_t

struct timevalue_t

The time value specifies either an aboslute time or a relative time offset.  An absolute time value is normally measured in seconds since Epoch, 1970-01-01 00:00:00 +0000 (UTC).  But this can differ between different clock types.

Summary
secondsThe seconds counted from some point in time.
nanosecThe nano seconds counted from some point in time.
lifetime
timevalue_INITStatic initializer.
query
isvalid_timevalueReturns true if tv contains a valid value.
diffms_timevalue

seconds

int64_t seconds

The seconds counted from some point in time.  The value is of signed type to allow computing the difference.

nanosec

int32_t nanosec

The nano seconds counted from some point in time.  This value is between 0 and 999999999.  The value is of signed type to allow computing the difference.

lifetime

timevalue_INIT

#define timevalue_INIT(seconds,
nano_secconds) { seconds, nano_secconds }

Static initializer.

query

isvalid_timevalue

bool isvalid_timevalue(timevalue_t *tv)

Returns true if tv contains a valid value.

diffms_timevalue

int64_t diffms_timevalue(timevalue_t *endtv,
timevalue_t *starttv)
Returns time difference of (endtvstarttv) in milliseconds.  The computed value is not checked for overflow !

Macros

isvalid_timevalue

diffms_timevalue

#define diffms_timevalue(
   endtv,
   starttv
) ( __extension__ ({ timevalue_t * _etv = (endtv) ; timevalue_t * _stv = (starttv) ; (_etv->seconds - _stv->seconds) * 1000 + (_etv->nanosec - _stv->nanosec) / 1000000 ; }))

Implements timevalue_t.diffms_timevalue.

Export type for specifing a time value.
typedef struct timevalue_t timevalue_t
Exports timevalue_t.
struct timevalue_t
The time value specifies either an aboslute time or a relative time offset.
int64_t seconds
The seconds counted from some point in time.
int32_t nanosec
The nano seconds counted from some point in time.
#define timevalue_INIT(seconds,
nano_secconds) { seconds, nano_secconds }
Static initializer.
bool isvalid_timevalue(timevalue_t *tv)
Returns true if tv contains a valid value.
int64_t diffms_timevalue(timevalue_t *endtv,
timevalue_t *starttv)
#define diffms_timevalue(
   endtv,
   starttv
) ( __extension__ ({ timevalue_t * _etv = (endtv) ; timevalue_t * _stv = (starttv) ; (_etv->seconds - _stv->seconds) * 1000 + (_etv->nanosec - _stv->nanosec) / 1000000 ; }))
Implements timevalue_t.diffms_timevalue.
Close