EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
epicsTimeHelper.h
1 // epicsTimeHelper
2 
3 #ifndef __EPICSTIMEHELPER_H__
4 #define __EPICSTIMEHELPER_H__
5 
6 // epics
7 #include "epicsTime.h"
8 
9 #include "tools/ToolsConfig.h"
10 
13 
21 {
22 public:
34  static bool parse(const stdString &t, double &n, double default_factor=1.0);
35 
39  static stdString format(double seconds);
40 };
41 
43 extern const epicsTime nullTime;
44 
46 bool isValidTime(const epicsTime &t);
47 
49 
57 bool string2epicsTime(const stdString &txt, epicsTime &time);
58 
60 
64 bool epicsTime2string(const epicsTime &time, stdString &txt);
65 
67 const char *epicsTimeTxt(const epicsTime &time, stdString &txt);
68 
70 
80 void epicsTime2vals(const epicsTime &time,
81  int &year, int &month, int &day,
82  int &hour, int &min, int &sec, unsigned long &nano);
83 
85 void vals2epicsTime(int year, int month, int day,
86  int hour, int min, int sec, unsigned long nano,
87  epicsTime &time);
88 
89 // Some of these are magic numbers because e.g.
90 // the number of seconds per month of course depends on the month.
91 #define secsPerMinute 60
92 #define secsPerHour (60*60)
93 #define secsPerDay (60*60*24)
94 #define secsPerMonth (60*60*24*31)
95 #define secsPerYear (60*60*24*31*365)
96 
98 epicsTime roundTime (const epicsTime &time, double secs);
99 
101 epicsTime roundTimeUp (const epicsTime &time, double secs);
102 
104 epicsTime roundTimeDown (const epicsTime &time, double secs);
105 
107 
108 #endif //__EPICSTIMEHELPER_H__
Parse seconds from text, and format seconds into text.
Definition: epicsTimeHelper.h:20
static bool parse(const stdString &t, double &n, double default_factor=1.0)
Parse text into number.
static stdString format(double seconds)