ajtime.c

Datatypes: AjPTime none


Datatype: AjPTime

Time object

Sections: constructors destructors get time get reference to internals set time comparison debug exit


Section: constructors

Functions for constructing time objects.

Functions: ajTimeNew ajTimeNewDayFmt ajTimeNewTime ajTimeNewToday ajTimeNewTodayFmt


Function ajTimeNew

Constructor for AjPTime object.

Synopsis

Prototype
AjPTime ajTimeNew (
      void
);

TypeNameRead/WriteDescription
AjPTime RETURNAn AjPTime object

Returns
AjPTime:An AjPTime object

Description

Constructor for AjPTime object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeNewDayFmt

Constructor for user specification of an arbitrary AjPTime object. Except for 'timefmt', the arguments are based upon the UNIX 'tm' time structure defined in the time.h header file. The range validity of numbers given are not checked.

Synopsis

Prototype
AjPTime ajTimeNewDayFmt (
      const char* timefmt,
      ajint mday,
      ajint mon,
      ajint year
);

TypeNameRead/WriteDescription
const char*timefmtInputTime format to use
ajintmdayInputDay of the month [1-31]
ajintmonInputMonth [1-12]
ajintyearInputFour digit year
AjPTime RETURNAn AjPTime object

Input
timefmt:(Input)Time format to use
mday:(Input)Day of the month [1-31]
mon:(Input)Month [1-12]
year:(Input)Four digit year
Returns
AjPTime:An AjPTime object

Description

Constructor for user specification of an arbitrary AjPTime object. Except for 'timefmt', the arguments are based upon the UNIX 'tm' time structure defined in the time.h header file. The range validity of numbers given are not checked.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeNewTime

Constructor for AjPTime object, making a copy of an existing time object

Synopsis

Prototype
AjPTime ajTimeNewTime (
      const AjPTime src
);

TypeNameRead/WriteDescription
const AjPTimesrcInputTime object to be copied
AjPTime RETURNAn AjPTime object

Input
src:(Input)Time object to be copied
Returns
AjPTime:An AjPTime object

Description

Constructor for AjPTime object, making a copy of an existing time object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeNewToday

AJAX function to return today's time as an AjPTime object

Synopsis

Prototype
AjPTime ajTimeNewToday (
      void
);

TypeNameRead/WriteDescription
AjPTime RETURNPointer to time object containing today's date/time

Returns
AjPTime:Pointer to time object containing today's date/time

Description

AJAX function to return today's time as an AjPTime object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeNewTodayFmt

AJAX function to return today's time as an AjPTime object with a specified output format

Synopsis

Prototype
AjPTime ajTimeNewTodayFmt (
      const char* timefmt
);

TypeNameRead/WriteDescription
const char*timefmtInputA controlled vocabulary of time formats
AjPTime RETURNPointer to time object containing today's date/time

Input
timefmt:(Input)A controlled vocabulary of time formats
Returns
AjPTime:Pointer to time object containing today's date/time

Description

AJAX function to return today's time as an AjPTime object with a specified output format

See Also

See other functions in this section

Availability

In release 6.4.0

Section: destructors

Functions for destroying time objects.

Functions: ajTimeDel


Function ajTimeDel

Destructor for AjPTime object.

Synopsis

Prototype
void ajTimeDel (
      AjPTime* Ptime
);

TypeNameRead/WriteDescription
AjPTime*PtimeOutputTime object pointer
void RETURN

Output
Ptime:(Output)Time object pointer
Returns
void:No return value

Description

Destructor for AjPTime object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: get time

Functions for retrieving elements of a time object

Functions: ajTimeGetTimetype


Function ajTimeGetTimetype

An AjPTime object version of the mktime function that returns a standard time_t value

Synopsis

Prototype
time_t ajTimeGetTimetype (
      const AjPTime thys
);

TypeNameRead/WriteDescription
const AjPTimethysInputTime object
time_t RETURNStandard time value

Input
thys:(Input)Time object
Returns
time_t:Standard time value

Description

An AjPTime object version of the mktime function that returns a standard time_t value

See Also

See other functions in this section

Availability

In release 6.4.0

Section: get reference to internals

Functions for retrieving references to time internals

Functions: ajTimeRefToday ajTimeRefTodayFmt


Function ajTimeRefToday

AJAX function to return today's time as an AjPTime object reference

Synopsis

Prototype
const AjPTime ajTimeRefToday (
      void
);

TypeNameRead/WriteDescription
const AjPTime RETURNPointer to static time object containing today's date/time

Returns
const AjPTime:Pointer to static time object containing today's date/time

Description

AJAX function to return today's time as an AjPTime object reference

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeRefTodayFmt

AJAX function to return today's time as a static AjPTime object with a specified output format

Synopsis

Prototype
const AjPTime ajTimeRefTodayFmt (
      const char* timefmt
);

TypeNameRead/WriteDescription
const char*timefmtInputA controlled vocabulary of time formats
const AjPTime RETURNPointer to static time object containing today's date/time

Input
timefmt:(Input)A controlled vocabulary of time formats
Returns
const AjPTime:Pointer to static time object containing today's date/time

Description

AJAX function to return today's time as a static AjPTime object with a specified output format

See Also

See other functions in this section

Availability

In release 6.4.0

Section: set time

Functions for setting the time.

Functions: ajTimeSetC ajTimeSetS ajTimeSetLocal


Function ajTimeSetC

Constructor for user specification of an AjPTime object. using the time set as a string in format yyyy-mm-dd hh:mm:ss

used so that graphs which include the date can remain constant for documentation and testing.

Synopsis

Prototype
AjBool ajTimeSetC (
      AjPTime thys,
      const char* timestr
);

TypeNameRead/WriteDescription
AjPTimethysOutputTime object
const char*timestrInputTime in format yyyy-mm-dd hh:mm:ss
AjBool RETURNajTrue on success

Input
timestr:(Input)Time in format yyyy-mm-dd hh:mm:ss
Output
thys:(Output)Time object
Returns
AjBool:ajTrue on success

Description

Constructor for user specification of an AjPTime object. using the time set as a string in format yyyy-mm-dd hh:mm:ss

used so that graphs which include the date can remain constant for documentation and testing.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeSetS

Constructor for user specification of an AjPTime object. using the time set as a string in format yyyy-mm-dd hh:mm:ss

used so that graphs which include the date can remain constant for documentation and testing.

Synopsis

Prototype
AjBool ajTimeSetS (
      AjPTime thys,
      const AjPStr timestr
);

TypeNameRead/WriteDescription
AjPTimethysOutputTime object
const AjPStrtimestrInputTime in format yyyy-mm-dd hh:mm:ss
AjBool RETURNajTrue on success

Input
timestr:(Input)Time in format yyyy-mm-dd hh:mm:ss
Output
thys:(Output)Time object
Returns
AjBool:ajTrue on success

Description

Constructor for user specification of an AjPTime object. using the time set as a string in format yyyy-mm-dd hh:mm:ss

used so that graphs which include the date can remain constant for documentation and testing.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajTimeSetLocal

A localtime()/localtime_r() replacement for AjPTime objects

Synopsis

Prototype
AjBool ajTimeSetLocal (
      AjPTime thys,
      const time_t timer
);

TypeNameRead/WriteDescription
AjPTimethysOutputTime object
const time_ttimerInputPopulated standard C time structure
AjBool RETURNtrue if successful

Input
timer:(Input)Populated standard C time structure
Output
thys:(Output)Time object
Returns
AjBool:true if successful

Description

A localtime()/localtime_r() replacement for AjPTime objects

See Also

See other functions in this section

Availability

In release 6.4.0

Section: comparison

Functions for comparing time objects.

Functions: ajTimeDiff


Function ajTimeDiff

Difference between two time objects

Synopsis

Prototype
double ajTimeDiff (
      const AjPTime thys,
      const AjPTime newtime
);

TypeNameRead/WriteDescription
const AjPTimethysInputOriginal time object
const AjPTimenewtimeInputLater time object
double RETURNDifference in seconds

Input
thys:(Input)Original time object
newtime:(Input)Later time object
Returns
double:Difference in seconds

Description

Difference between two time objects

See Also

See other functions in this section

Availability

In release 6.4.0

Section: debug

Functions for debugging time objects.

Functions: ajTimeTrace


Function ajTimeTrace

Debug report on the contents of an AjPTime object

Synopsis

Prototype
void ajTimeTrace (
      const AjPTime thys
);

TypeNameRead/WriteDescription
const AjPTimethysInputTime object
void RETURN

Input
thys:(Input)Time object
Returns
void:No return value

Description

Debug report on the contents of an AjPTime object

See Also

See other functions in this section

Availability

In release 6.4.0

Section: exit

Functions called on exit from the program by ajExit to do any necessary cleanup and to report internal statistics to the debug file

Functions: ajTimeExit


Function ajTimeExit

Cleans up time processing internal memory

Synopsis

Prototype
void ajTimeExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Cleans up time processing internal memory

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: none

time internals

Sections: reset


Section: reset

Functions for memory cleanup

Functions: ajTimeReset


Function ajTimeReset

Resets the clock time to zero

Synopsis

Prototype
void ajTimeReset (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Resets the clock time to zero

See Also

See other functions in this section

Availability

In release 6.4.0

Section: get cpu time

Functions for retrieving CPU time

Functions: ajClockDiff ajClockNow ajClockSeconds


Function ajClockDiff

Returns the cpu time in seconds between two clock values

Synopsis

Prototype
double ajClockDiff (
      ajlong starttime,
      ajlong nowtime
);

TypeNameRead/WriteDescription
ajlongstarttimeInputstart time
ajlongnowtimeInputcurrent time
double RETURNTotal cpu clock time in seconds

Input
starttime:(Input)start time
nowtime:(Input)current time
Returns
double:Total cpu clock time in seconds

Description

Returns the cpu time in seconds between two clock values

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajClockNow

Returns the clock time as a long even for systems where the clock_t type is 4 bytes

Synopsis

Prototype
ajlong ajClockNow (
      void
);

TypeNameRead/WriteDescription
ajlong RETURNTotal clock ticks

Returns
ajlong:Total clock ticks

Description

Returns the clock time as a long even for systems where the clock_t type is 4 bytes

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajClockSeconds

Returns the cpu time in seconds since the start

Synopsis

Prototype
double ajClockSeconds (
      void
);

TypeNameRead/WriteDescription
double RETURNTotal cpu clock time in seconds

Returns
double:Total cpu clock time in seconds

Description

Returns the cpu time in seconds since the start

See Also

See other functions in this section

Availability

In release 6.4.0

Section: reset

Functions for CPU time memory cleanup

Functions: ajClockReset


Function ajClockReset

Resets the clock time to zero

Synopsis

Prototype
void ajClockReset (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Resets the clock time to zero

See Also

See other functions in this section

Availability

In release 6.4.0