ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbTime.c File Reference
#include <ngc/core/ngcb.h>
#include <time.h>
#include <sys/timex.h>
#include <poll.h>

Macros

#define _GNU_SOURCE
 
#define _REENTRANT
 

Functions

int ngcbTaiOffset ()
 
int ngcbGetTime (struct timeval *t)
 
void ngcbSubTime (struct timeval t1, struct timeval t2, struct timeval *t3)
 
void ngcbAddTime (struct timeval t1, struct timeval t2, struct timeval *t3)
 
void ngcbAddSec (struct timeval *t, double seconds)
 
int ngcbGetUTC (char *utc, int precision)
 
double ngcbGetMJD (void)
 
void ngcbTime2UTC (struct timeval t, char *utc, int precision)
 
double ngcbTime2MJD (struct timeval t)
 
void ngcbMJD2UTC (double mjd, char *utc, int precision)
 
double ngcbUTC2MJD (const char *utc)
 
int ngcbMicroSleep (int fd, int waitTime)
 
int ngcbSleep (int fd, int waitTime)
 
void ngcbAddTimeFrac (uint64_t *sec, uint64_t *nsec, double t)
 
void ngcbTimeFrac2Str (char *value, uint64_t sec, uint64_t nsec)
 

Detailed Description

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ _REENTRANT

#define _REENTRANT

Function Documentation

◆ ngcbAddSec()

void ngcbAddSec ( struct timeval * t,
double seconds )

Add seconds to a time-stamp values. The value of seconds may be both positive or negative (or zero).

◆ ngcbAddTime()

void ngcbAddTime ( struct timeval t1,
struct timeval t2,
struct timeval * t3 )

Add two time-stamp values and stores the result of (t1 + t2) in t3.

◆ ngcbAddTimeFrac()

void ngcbAddTimeFrac ( uint64_t * sec,
uint64_t * nsec,
double t )

Add time (in seconds) to a fraction value (48 bit seconds and 30 bit nanoseconds + 16 bit fraction of nanoseconds).

◆ ngcbGetMJD()

double ngcbGetMJD ( void )

Get the current time as Modified Julian Date.

◆ ngcbGetTime()

int ngcbGetTime ( struct timeval * t)

Store a time-stamp.

◆ ngcbGetUTC()

int ngcbGetUTC ( char * utc,
int precision )

Get the UTC in ISO format. If precision is greater than zero, then a fraction of seconds with precision digits is appended.

◆ ngcbMicroSleep()

int ngcbMicroSleep ( int fd,
int waitTime )

Suspend process execution for waitTime microseconds. The sleep can be interrupted by writing to the file descriptor fd which will be closed in that case. If fd has a negative value then the sleep cannot be interrupted.

◆ ngcbMJD2UTC()

void ngcbMJD2UTC ( double mjd,
char * utc,
int precision )

Convert a Modified Julian Date into UTC in ISO format. If precision is greater than zero, then a fraction of seconds with precision digits is appended.

◆ ngcbSleep()

int ngcbSleep ( int fd,
int waitTime )

Suspend process execution for waitTime seconds. The sleep can be interrupted by writing to fd which will be closed in that case. If the termSock has a negative value, the sleep cannot be interrupted.

◆ ngcbSubTime()

void ngcbSubTime ( struct timeval t1,
struct timeval t2,
struct timeval * t3 )

Subtracts two time-stamp values and stores the result of (t2 - t1) in t3.

◆ ngcbTaiOffset()

int ngcbTaiOffset ( )

Get TAI offset (seconds)

◆ ngcbTime2MJD()

double ngcbTime2MJD ( struct timeval t)

Return the Modified Julian Date of a time-stamp.

◆ ngcbTime2UTC()

void ngcbTime2UTC ( struct timeval t,
char * utc,
int precision )

Convert the time-stamp into ISO-format. If precision is greater than zero, then a fraction of seconds with precision digits is appended.

◆ ngcbTimeFrac2Str()

void ngcbTimeFrac2Str ( char * value,
uint64_t sec,
uint64_t nsec )

Convert a time given in seconds and 30 bit nanoseconds + 16 bit fraction of nanoseconds to a string representing seconds in a high precision floating point number.

◆ ngcbUTC2MJD()

double ngcbUTC2MJD ( const char * utc)

Convert an UTC time string in ISO format into Modified Julian Date format. A return value of 0.0 indicates a conversion error.