ProviewR Programmer's Reference Manual  V6.1.4
Functions
co_time.c File Reference

Functions for Time management. More...

#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "co_string.h"
#include "co_time.h"
#include "co_time_msg.h"

Go to the source code of this file.

Functions

int time_IsNull (pwr_tTime *t1)
 Test if time is Null.
 
pwr_tTime * time_Aadd (pwr_tTime *result, pwr_tTime *t, pwr_tDeltaTime *a)
 Add an absolute time and a delta time. More...
 
pwr_tTime * time_Aadd_NE (pwr_tTime *result, pwr_tTime *t, pwr_tDeltaTime *a)
 Add an absolute time and a delta time. More...
 
int time_Acomp (pwr_tTime *t1, pwr_tTime *t2)
 Compare two timespecs. More...
 
int time_Acomp_NE (pwr_tTime *t1, pwr_tTime *t2)
 Compare two timespecs. More...
 
pwr_tDeltaTimetime_Adiff (pwr_tDeltaTime *r, pwr_tTime *t, pwr_tTime *s)
 Subtract a time from a time,. More...
 
pwr_tDeltaTimetime_Adiff_NE (pwr_tDeltaTime *r, pwr_tTime *t, pwr_tTime *s)
 Subtract a time from a time,. More...
 
pwr_tTime * time_Asub (pwr_tTime *result, pwr_tTime *t, pwr_tDeltaTime *s)
 Subtract a delta time from a time,. More...
 
pwr_tTime * time_Asub_NE (pwr_tTime *result, pwr_tTime *t, pwr_tDeltaTime *s)
 Subtract a delta time from a time,. More...
 
pwr_tDeltaTimetime_Dabs (pwr_tDeltaTime *result, pwr_tDeltaTime *t)
 Take the absolute walue of a delta time. More...
 
pwr_tDeltaTimetime_Dabs_NE (pwr_tDeltaTime *result, pwr_tDeltaTime *t)
 Take the absolute walue of a delta time. More...
 
pwr_tDeltaTimetime_Dadd (pwr_tDeltaTime *result, pwr_tDeltaTime *t, pwr_tDeltaTime *a)
 Add two delta times, the result is also delta. More...
 
pwr_tDeltaTimetime_Dadd_NE (pwr_tDeltaTime *result, pwr_tDeltaTime *t, pwr_tDeltaTime *a)
 Add two delta times, the result is also delta. More...
 
int time_Dcomp (pwr_tDeltaTime *t1, pwr_tDeltaTime *t2)
 Compare two delta times. More...
 
int time_Dcomp_NE (pwr_tDeltaTime *t1, pwr_tDeltaTime *t2)
 Compare two delta times. More...
 
pwr_tDeltaTimetime_Dneg (pwr_tDeltaTime *result, pwr_tDeltaTime *t)
 Negate a delta time,. More...
 
pwr_tDeltaTimetime_Dneg_NE (pwr_tDeltaTime *result, pwr_tDeltaTime *t)
 Negate a delta time,. More...
 
pwr_tDeltaTimetime_Dsub (pwr_tDeltaTime *result, pwr_tDeltaTime *t, pwr_tDeltaTime *s)
 Subtract two delta times. More...
 
pwr_tDeltaTimetime_Dsub_NE (pwr_tDeltaTime *result, pwr_tDeltaTime *t, pwr_tDeltaTime *s)
 Subtract two delta times. More...
 
pwr_tStatus time_DtoAscii (pwr_tDeltaTime *dt, int hundreds, char *buf, int bufsize)
 Convert a delta time to ascii string.
 
pwr_tStatus time_AtoAscii (pwr_tTime *ts, time_eFormat format, char *buf, int bufsize)
 Convert timespec to ascii. More...
 
char * time_GetTimeAscii (time_eFormat format)
 Get current time in ascii.
 
pwr_tStatus time_AsciiToD (const char *tstr, pwr_tDeltaTime *ts)
 Convert ascii to timespec.
 
pwr_tStatus time_AsciiToA (const char *tstr, pwr_tTime *ts)
 Convert ascii time to timespec.
 
pwr_tStatus time_TmToAscii (struct tm *tmptr, time_eFormat format, char *buf, int bufsize)
 Convert time struct to string.
 
pwr_tStatus time_AsciiToTm (const char *tstr, struct tm *tmptr)
 Convert timestring to struct.
 
pwr_tDeltaTimetime_MsToD (pwr_tDeltaTime *dt, pwr_tInt32 ms)
 Convert millisec to timespec. More...
 
pwr_tDeltaTimetime_FloatToD (pwr_tDeltaTime *dt, pwr_tFloat32 f)
 Convert float to time. More...
 
pwr_tDeltaTimetime_Float64ToD (pwr_tDeltaTime *dt, pwr_tFloat64 f)
 Convert double to time. More...
 
pwr_tFloat32 time_DToFloat (pwr_tFloat32 *f, pwr_tDeltaTime *dt)
 Convert time to Float32. More...
 
pwr_tFloat64 time_DToFloat64 (pwr_tFloat64 *f, pwr_tDeltaTime *dt)
 Convert time to Float64.
 
time_tClock time_DtoClock (pwr_tStatus *status, pwr_tDeltaTime *tp)
 Convert delta time to clock time.
 
pwr_tDeltaTimetime_ClockToD (pwr_tStatus *status, pwr_tDeltaTime *tp, time_tClock clock)
 Convert clock time to delta time.
 
pwr_tDeltaTimetime_ZeroD (pwr_tDeltaTime *tp)
 Zero a delta time.
 
int time_GetTime (pwr_tTime *ts)
 Get current time.
 
int time_GetTimeMonotonic (pwr_tTime *ts)
 Get current monotonic time.
 
int time_PeriodMonth (pwr_tTime *time, pwr_tTime *from, pwr_tTime *to, int previous)
 Calculate start and end time for month.
 
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

Functions for Time management.

ProviewR Open Source Process Control. Copyright (C) 2005-2025 SSAB EMEA AB.

This file is part of ProviewR.

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.

You should have received a copy of the GNU General Public License along with ProviewR. If not, see http://www.gnu.org/licenses/

Linking ProviewR statically or dynamically with other modules is making a combined work based on ProviewR. Thus, the terms and conditions of the GNU General Public License cover the whole combination.

In addition, as a special exception, the copyright holders of ProviewR give you permission to, from the build function in the ProviewR Configurator, combine ProviewR with modules generated by the ProviewR PLC Editor to a PLC program, regardless of the license terms of these modules. You may copy and distribute the resulting combined work under the terms of your choice, provided that every copy of the combined work is accompanied by a complete copy of the source code of ProviewR (the version used to produce the combined work), being distributed under the terms of the GNU General Public License plus this exception.

Definition in file co_time.c.