ProviewR Programmer's Reference Manual  V6.1.4
Functions
Time Functions

Functions

int time_IsNull (pwr_tTime *t1)
 Test if time is Null.
 
pwr_tTime * time_Aadd (pwr_tTime *, pwr_tTime *, pwr_tDeltaTime *)
 Add an absolute time and a delta time. More...
 
pwr_tTime * time_Aadd_NE (pwr_tTime *, pwr_tTime *, pwr_tDeltaTime *)
 Add an absolute time and a delta time. More...
 
int time_Acomp (pwr_tTime *, pwr_tTime *)
 Compare two timespecs. More...
 
int time_Acomp_NE (pwr_tTime *, pwr_tTime *)
 Compare two timespecs. More...
 
pwr_tDeltaTimetime_Adiff (pwr_tDeltaTime *, pwr_tTime *, pwr_tTime *)
 Subtract a time from a time,. More...
 
pwr_tDeltaTimetime_Adiff_NE (pwr_tDeltaTime *, pwr_tTime *, pwr_tTime *)
 Subtract a time from a time,. More...
 
pwr_tTime * time_Asub (pwr_tTime *, pwr_tTime *, pwr_tDeltaTime *)
 Subtract a delta time from a time,. More...
 
pwr_tTime * time_Asub_NE (pwr_tTime *, pwr_tTime *, pwr_tDeltaTime *)
 Subtract a delta time from a time,. More...
 
pwr_tDeltaTimetime_Dabs (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Take the absolute walue of a delta time. More...
 
pwr_tDeltaTimetime_Dabs_NE (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Take the absolute walue of a delta time. More...
 
pwr_tDeltaTimetime_Dadd (pwr_tDeltaTime *, pwr_tDeltaTime *, pwr_tDeltaTime *)
 Add two delta times, the result is also delta. More...
 
pwr_tDeltaTimetime_Dadd_NE (pwr_tDeltaTime *, pwr_tDeltaTime *, pwr_tDeltaTime *)
 Add two delta times, the result is also delta. More...
 
pwr_tDeltaTimetime_Dneg (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Negate a delta time,. More...
 
pwr_tDeltaTimetime_Dneg_NE (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Negate a delta time,. More...
 
pwr_tDeltaTimetime_Dsub (pwr_tDeltaTime *, pwr_tDeltaTime *, pwr_tDeltaTime *)
 Subtract two delta times. More...
 
pwr_tDeltaTimetime_Dsub_NE (pwr_tDeltaTime *, pwr_tDeltaTime *, pwr_tDeltaTime *)
 Subtract two delta times. More...
 
int time_Dcomp (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Compare two delta times. More...
 
int time_Dcomp_NE (pwr_tDeltaTime *, pwr_tDeltaTime *)
 Compare two delta times. More...
 
pwr_tStatus time_DtoAscii (pwr_tDeltaTime *, int, char *, int)
 Convert a delta time to ascii string.
 
pwr_tStatus time_AtoAscii (pwr_tTime *, time_eFormat, char *, int)
 Convert timespec to ascii. More...
 
pwr_tStatus time_AsciiToD (const char *, pwr_tDeltaTime *)
 Convert ascii to timespec.
 
pwr_tStatus time_AsciiToA (const char *, pwr_tTime *)
 Convert ascii time to timespec.
 
pwr_tStatus time_TmToAscii (struct tm *, time_eFormat, char *, int)
 Convert time struct to string.
 
pwr_tStatus time_AsciiToTm (const char *, struct tm *)
 Convert timestring to struct.
 
pwr_tDeltaTimetime_MsToD (pwr_tDeltaTime *, pwr_tInt32)
 Convert millisec to timespec. More...
 
pwr_tDeltaTimetime_FloatToD (pwr_tDeltaTime *, pwr_tFloat32)
 Convert float to time. More...
 
pwr_tDeltaTimetime_Float64ToD (pwr_tDeltaTime *, pwr_tFloat64)
 Convert double to time. More...
 
pwr_tFloat32 time_DToFloat (pwr_tFloat32 *, pwr_tDeltaTime *)
 Convert time to Float32. More...
 
pwr_tFloat64 time_DToFloat64 (pwr_tFloat64 *, pwr_tDeltaTime *)
 Convert time to Float64.
 
time_tClock time_DtoClock (pwr_tStatus *, pwr_tDeltaTime *)
 Convert delta time to clock time.
 
pwr_tDeltaTimetime_ClockToD (pwr_tStatus *, pwr_tDeltaTime *, time_tClock)
 Convert clock time to delta time.
 
pwr_tDeltaTimetime_ZeroD (pwr_tDeltaTime *)
 Zero a delta time.
 
int time_GetTime (pwr_tTime *ts)
 Get current time.
 
int time_GetTimeMonotonic (pwr_tTime *ts)
 Get current monotonic time.
 
char * time_GetTimeAscii (time_eFormat format)
 Get current time in ascii.
 
int time_PeriodPreviousWeek (pwr_tTime *time, pwr_tTime *from, pwr_tTime *to)
 Calculate start and end time for previous week. More...
 
void time_PreviousDayBreak (pwr_tTime *time, pwr_tTime *daybreak)
 Calculate previous daybreak.
 
int time_PrintA (const char *format, pwr_tTime *ts)
 Print an absolute time. The format should contain s.
 
pwr_tFloat32 time_AdiffToFloat (pwr_tTime *t, pwr_tTime *s)
 Subtract a time from a time and return the differens. More...
 

Detailed Description

Function Documentation

◆ time_Aadd()

pwr_tTime* time_Aadd ( pwr_tTime *  result,
pwr_tTime *  t,
pwr_tDeltaTime a 
)

Add an absolute time and a delta time.

Add two timespecs, result = t + d, where:

  • 'result' and 't' is an absolute time, and
  • 'd' is a delta time.

If 'result' argument is NULL then 't' will be used as resultant. Returns the address to the resulting time.

Input arguments containing invalid times will cause an exception.

Definition at line 199 of file co_time.c.

◆ time_Aadd_NE()

pwr_tTime* time_Aadd_NE ( pwr_tTime *  result,
pwr_tTime *  t,
pwr_tDeltaTime a 
)

Add an absolute time and a delta time.

Add two timespecs, result = t + d, where:

  • 'result' and 't' is an absolute time, and
  • 'd' is a delta time.

If 'result' argument is NULL then 't' will be used as resultant. Returns the address to the resulting time.

If any input argument contains an invalid time an invalid time, pwr_cNotATime, is returned.

Definition at line 240 of file co_time.c.

◆ time_Acomp()

int time_Acomp ( pwr_tTime *  t1,
pwr_tTime *  t2 
)

Compare two timespecs.

Returns
1 if t1 > t2
0 if t1 == t2
-1 if t1 < t2
If argument 't2' is NULL the comparison will be done as if t2 == 0.

Input arguments containing invalid times will cause an exception.

Definition at line 282 of file co_time.c.

◆ time_Acomp_NE()

int time_Acomp_NE ( pwr_tTime *  t1,
pwr_tTime *  t2 
)

Compare two timespecs.

Returns
1 if t1 > t2
0 if t1 == t2
-1 if t1 < t2
If argument 't2' is NULL the comparison will be done as if t2 == 0.

If any input argument contains an invalid time -2 is returned.

Definition at line 312 of file co_time.c.

◆ time_Adiff()

pwr_tDeltaTime* time_Adiff ( pwr_tDeltaTime r,
pwr_tTime *  t,
pwr_tTime *  s 
)

Subtract a time from a time,.

r = t - s

Result is always a delta time.

Input arguments containing invalid times will cause an exception.

Definition at line 339 of file co_time.c.

Referenced by time_AdiffToFloat().

◆ time_Adiff_NE()

pwr_tDeltaTime* time_Adiff_NE ( pwr_tDeltaTime r,
pwr_tTime *  t,
pwr_tTime *  s 
)

Subtract a time from a time,.

r = t - s

Result is always a delta time.

If any input argument contains an invalid time an invalid time, pwr_cNotADeltaTime, is returned.

Definition at line 373 of file co_time.c.

◆ time_AdiffToFloat()

pwr_tFloat32 time_AdiffToFloat ( pwr_tTime *  t,
pwr_tTime *  s 
)

Subtract a time from a time and return the differens.

as a float value. Input arguments containing invalid times will cause an exception.

Definition at line 2225 of file co_time.c.

References time_Adiff(), and time_DToFloat().

◆ time_Asub()

pwr_tTime* time_Asub ( pwr_tTime *  result,
pwr_tTime *  t,
pwr_tDeltaTime s 
)

Subtract a delta time from a time,.

r = t - s

Result is always an abstime.

Input arguments containing invalid times will cause an exception.

Definition at line 408 of file co_time.c.

◆ time_Asub_NE()

pwr_tTime* time_Asub_NE ( pwr_tTime *  result,
pwr_tTime *  t,
pwr_tDeltaTime s 
)

Subtract a delta time from a time,.

r = t - s

Result is always an abstime.

If any input argument contains an invalid time an invalid time, pwr_cNotATime, is returned.

Definition at line 444 of file co_time.c.

◆ time_AtoAscii()

pwr_tStatus time_AtoAscii ( pwr_tTime *  ts,
time_eFormat  format,
char *  buf,
int  bufsize 
)

Convert timespec to ascii.

NOTE: Not thread safe.

Definition at line 878 of file co_time.c.

Referenced by time_GetTimeAscii(), and time_PrintA().

◆ time_Dabs()

pwr_tDeltaTime* time_Dabs ( pwr_tDeltaTime result,
pwr_tDeltaTime t 
)

Take the absolute walue of a delta time.

'result' = |'t'|

A NULL address => abs value is written to 't'. Returns the address to the resulting time.

Input arguments containing invalid times will cause an exception.

Definition at line 484 of file co_time.c.

◆ time_Dabs_NE()

pwr_tDeltaTime* time_Dabs_NE ( pwr_tDeltaTime result,
pwr_tDeltaTime t 
)

Take the absolute walue of a delta time.

'result' = |'t'|

A NULL address => abs value is written to 't'. Returns the address to the resulting time.

If any input argument contains an invalid time an invalid time, pwr_cNotADeltaTime, is returned.

Definition at line 516 of file co_time.c.

◆ time_Dadd()

pwr_tDeltaTime* time_Dadd ( pwr_tDeltaTime result,
pwr_tDeltaTime t,
pwr_tDeltaTime a 
)

Add two delta times, the result is also delta.

If 'result' is NULL then 'a' will be added to 't'.

Input arguments containing invalid times will cause an exception.

Definition at line 547 of file co_time.c.

◆ time_Dadd_NE()

pwr_tDeltaTime* time_Dadd_NE ( pwr_tDeltaTime result,
pwr_tDeltaTime t,
pwr_tDeltaTime a 
)

Add two delta times, the result is also delta.

If 'result' is NULL then 'a' will be added to 't'.

If any input argument contains an invalid time an invalid time, pwr_cNotADeltaTime, is returned.

Definition at line 584 of file co_time.c.

◆ time_Dcomp()

int time_Dcomp ( pwr_tDeltaTime t1,
pwr_tDeltaTime t2 
)

Compare two delta times.

Returns
1 if t1 > t2
0 if t1 == t2
-1 if t1 < t2
If argument 't2' is NULL the comparison will be done as if t2 == 0.

Input arguments containing invalid times will cause an exception.

Definition at line 629 of file co_time.c.

◆ time_Dcomp_NE()

int time_Dcomp_NE ( pwr_tDeltaTime t1,
pwr_tDeltaTime t2 
)

Compare two delta times.

Returns
1 if t1 > t2
0 if t1 == t2
-1 if t1 < t2
If argument 't2' is NULL the comparison will be done as if t2 == 0.

If any input argument contains an invalid time -2 is returned.

Definition at line 660 of file co_time.c.

◆ time_Dneg()

pwr_tDeltaTime* time_Dneg ( pwr_tDeltaTime result,
pwr_tDeltaTime t 
)

Negate a delta time,.

result = -d

If 'result' argument is NULL then 'd' will be used as resultant. Returns the address to the resulting time.

Input arguments containing invalid times will cause an exception.

Definition at line 690 of file co_time.c.

◆ time_Dneg_NE()

pwr_tDeltaTime* time_Dneg_NE ( pwr_tDeltaTime result,
pwr_tDeltaTime t 
)

Negate a delta time,.

result = -d

If 'result' argument is NULL then 'd' will be used as resultant. Returns the address to the resulting time.

If any input argument contains an invalid time an invalid time, pwr_cNotADeltaTime, is returned.

Definition at line 721 of file co_time.c.

◆ time_Dsub()

pwr_tDeltaTime* time_Dsub ( pwr_tDeltaTime result,
pwr_tDeltaTime t,
pwr_tDeltaTime s 
)

Subtract two delta times.

The result is also delta.

Input arguments containing invalid times will cause an exception.

Definition at line 750 of file co_time.c.

◆ time_Dsub_NE()

pwr_tDeltaTime* time_Dsub_NE ( pwr_tDeltaTime result,
pwr_tDeltaTime t,
pwr_tDeltaTime s 
)

Subtract two delta times.

The result is also delta.

If any input argument contains an invalid time an invalid time, pwr_cNotADeltaTime, is returned.

Definition at line 786 of file co_time.c.

◆ time_DToFloat()

pwr_tFloat32 time_DToFloat ( pwr_tFloat32 f,
pwr_tDeltaTime dt 
)

Convert time to Float32.

Not thread safe if f is NULL.

Definition at line 1340 of file co_time.c.

Referenced by time_AdiffToFloat().

◆ time_Float64ToD()

pwr_tDeltaTime* time_Float64ToD ( pwr_tDeltaTime dt,
pwr_tFloat64  f 
)

Convert double to time.

Not thread safe if dt is NULL.

Definition at line 1316 of file co_time.c.

◆ time_FloatToD()

pwr_tDeltaTime* time_FloatToD ( pwr_tDeltaTime dt,
pwr_tFloat32  f 
)

Convert float to time.

Not thread safe if dt is NULL.

Definition at line 1293 of file co_time.c.

◆ time_MsToD()

pwr_tDeltaTime* time_MsToD ( pwr_tDeltaTime dt,
pwr_tInt32  ms 
)

Convert millisec to timespec.

Not thread safe if dt is NULL.

Definition at line 1275 of file co_time.c.

◆ time_PeriodPreviousWeek()

int time_PeriodPreviousWeek ( pwr_tTime *  time,
pwr_tTime *  from,
pwr_tTime *  to 
)

Calculate start and end time for previous week.

Computes dates for monday to sunday in the previous week from the time now. Output times are only date, e g 1-MAY-1992 00:00:00.00.

Definition at line 1622 of file co_time.c.