VTK  9.2.6
vtkTimePointUtility.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTimePointUtility.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
31 #ifndef vtkTimePointUtility_h
32 #define vtkTimePointUtility_h
33 
34 #include "vtkCommonCoreModule.h" // For export macro
35 #include "vtkObject.h"
36 
37 class VTKCOMMONCORE_EXPORT vtkTimePointUtility : public vtkObject
38 {
39 public:
40  static vtkTimePointUtility* New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  static vtkTypeUInt64 DateToTimePoint(int year, int month, int day);
48 
53  static vtkTypeUInt64 TimeToTimePoint(int hour, int minute, int second, int millis = 0);
54 
58  static vtkTypeUInt64 DateTimeToTimePoint(
59  int year, int month, int day, int hour, int minute, int sec, int millis = 0);
60 
65  static void GetDate(vtkTypeUInt64 time, int& year, int& month, int& day);
66 
71  static void GetTime(vtkTypeUInt64 time, int& hour, int& minute, int& second, int& millis);
72 
77  static void GetDateTime(vtkTypeUInt64 time, int& year, int& month, int& day, int& hour,
78  int& minute, int& second, int& millis);
79 
83  static int GetYear(vtkTypeUInt64 time);
84 
88  static int GetMonth(vtkTypeUInt64 time);
89 
93  static int GetDay(vtkTypeUInt64 time);
94 
98  static int GetHour(vtkTypeUInt64 time);
99 
103  static int GetMinute(vtkTypeUInt64 time);
104 
108  static int GetSecond(vtkTypeUInt64 time);
109 
113  static int GetMillisecond(vtkTypeUInt64 time);
114 
115  enum
116  {
117  ISO8601_DATETIME_MILLIS = 0,
118  ISO8601_DATETIME = 1,
119  ISO8601_DATE = 2,
120  ISO8601_TIME_MILLIS = 3,
121  ISO8601_TIME = 4
122  };
123 
124  static const int MILLIS_PER_SECOND;
125  static const int MILLIS_PER_MINUTE;
126  static const int MILLIS_PER_HOUR;
127  static const int MILLIS_PER_DAY;
128  static const int SECONDS_PER_MINUTE;
129  static const int SECONDS_PER_HOUR;
130  static const int SECONDS_PER_DAY;
131  static const int MINUTES_PER_HOUR;
132  static const int MINUTES_PER_DAY;
133  static const int HOURS_PER_DAY;
134 
142  static vtkTypeUInt64 ISO8601ToTimePoint(const char* str, bool* ok = nullptr);
143 
162  static const char* TimePointToISO8601(vtkTypeUInt64, int format = ISO8601_DATETIME_MILLIS);
163 
164 protected:
165  vtkTimePointUtility() = default;
166  ~vtkTimePointUtility() override = default;
167 
168 private:
169  vtkTimePointUtility(const vtkTimePointUtility&) = delete;
170  void operator=(const vtkTimePointUtility&) = delete;
171 };
172 
173 #endif
static const int MINUTES_PER_HOUR
static const int SECONDS_PER_MINUTE
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static const int MILLIS_PER_DAY
static const int MINUTES_PER_DAY
static const int MILLIS_PER_SECOND
static const int MILLIS_PER_MINUTE
a simple class to control print indentation
Definition: vtkIndent.h:39
static const int MILLIS_PER_HOUR
static const int HOURS_PER_DAY
performs common time operations
std::vector< std::pair< int, double > > GetTime(const Ioss::Region *region)
Reads time / timestep information from a region.
static const int SECONDS_PER_DAY
static const int SECONDS_PER_HOUR
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...