Main Page | Data Structures | File List | Data Fields | Globals

utils.c File Reference

Server utility routines. More...

#include "isisserver.h"

Functions

void getUTCTime (void)
 Read the UTC time from the system clock.
char * getFineTime (void)
 Return the UTC time to microsecond precision.
char * getDateTime (void)
 Return the UTC date and time to microsecond precision as a system timestamp.
double sysTimeStamp (void)
 Return the elapsed time in sec since UTC 1970-01-01 with microsec precision.
char * noonDateTag (void)
 Local noon-to-noon date tag in CCYYMMDD format.
void upperCase (char *str)
 Convert a string to all uppercase.
void getArg (char *argStr, int argNum, char *returnStr)
 Extract an argument from the command line.


Detailed Description

Server utility routines.

A suite of basic utility functions, primarily for string and time handling, used by the ISIS server application.

Some of these are not used - we'll either ignore that or clean up in the future.


Function Documentation

void getUTCTime void   ) 
 

Read the UTC time from the system clock.

Reads the system's UTC time clock and puts date/time information into the system table.

Time info is stored as follows:

  • isis.dateTag has a date tag in ccyymmdd format
  • isis.utcDate has the UTC date in ISO8601-compliant CCYY-MM-DD format
  • isis.utcTime has the UTC time in hh:mm:ss format

char* getFineTime void   ) 
 

Return the UTC time to microsecond precision.

Reads the system's UTC time clock and returns a pointer to a string with the fine-grained UTC time in hh:mm:ss.ssssss format.

Based on gf_time() from Stevens, W.R., 1998, Unix Network Programming, Vol 2, Prentice Hall, Figure 15.6, but I make a string, and restrict the output of seconds to msec rather than usec.

Of course, it may return microsecond precision, microsecond accuracy is quite another thing...

char* getDateTime void   ) 
 

Return the UTC date and time to microsecond precision as a system timestamp.

Reads the system's UTC time clock and returns a pointer to a string with the fine-grained UTC time in hh:mm:ss.ssssss format.

Based on gf_time() from Stevens, W.R., 1998, Unix Network Programming, Vol 2, Prentice Hall, Figure 15.6, but I make a string, and restrict the output of seconds to msec rather than usec.

Of course, it may return microsecond precision, microsecond accuracy is quite another thing...

double sysTimeStamp void   ) 
 

Return the elapsed time in sec since UTC 1970-01-01 with microsec precision.

Reads the system's time clock and returns a double-precision value with the time in seconds and microseconds since UTC 1970-01-01. This provides us with a fine-grained numerical timestamp for the system.

Of course, it may return microsecond precision, microsecond accuracy is quite another thing. The relative time should be as stable as PC system clocks ever are.

char* noonDateTag void   ) 
 

Local noon-to-noon date tag in CCYYMMDD format.

Convenience function for creating noon-to-noon date tags in the local time zone. If the time is after noon, it uses the current local date. If before noon, it uses *yesterday's* local date.

This convention is used for "observing day", to avoid the problem with UTC that afternoon calibrations end up in the previous night's logs, or with using local midnight where logs of a night's observing are divided between two "civil day" logs.

void upperCase char *  str  ) 
 

Convert a string to all uppercase.

Parameters:
str String to convert to uppercase
BEWARE: Changes the string being converted!

void getArg char *  argStr,
int  argNum,
char *  returnStr
 

Extract an argument from the command line.

Parameters:
argStr string containing the argument list
argNum number of the argument to extract
returnStr string to contain the extracted argnum-th argument
Simple command-line argument parser. Works OK, but will probably replace someday by something fancier of the need arises.

Returns a null (\0) in regarg if the argnum-th argument doesn't exist.

If any stray nulls are found in the string, it replaces them with spaces.


Generated on Tue Apr 16 17:04:08 2013 for ISIS Server by  doxygen 1.3.9.1