VTK
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 -------------------------------------------------------------------------*/
30 #ifndef vtkTimePointUtility_h
31 #define vtkTimePointUtility_h
32 
33 #include "vtkCommonCoreModule.h" // For export macro
34 #include "vtkObject.h"
35 
37 {
38 public:
39  static vtkTimePointUtility *New();
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44 
45  static vtkTypeUInt64 DateToTimePoint(
46  int year, int month, int day);
48 
50 
52  static vtkTypeUInt64 TimeToTimePoint(
53  int hour, int minute, int second, int millis = 0);
55 
57 
58  static vtkTypeUInt64 DateTimeToTimePoint(
59  int year, int month, int day,
60  int hour, int minute, int sec, int millis = 0);
62 
64 
66  static void GetDate(vtkTypeUInt64 time,
67  int& year, int& month, int& day);
69 
71 
73  static void GetTime(vtkTypeUInt64 time,
74  int& hour, int& minute, int& second, int& millis);
76 
78 
80  static void GetDateTime(vtkTypeUInt64 time,
81  int& year, int& month, int& day,
82  int& hour, int& minute, int& second, int& millis);
84 
86  static int GetYear(vtkTypeUInt64 time);
87 
89  static int GetMonth(vtkTypeUInt64 time);
90 
92  static int GetDay(vtkTypeUInt64 time);
93 
95  static int GetHour(vtkTypeUInt64 time);
96 
98  static int GetMinute(vtkTypeUInt64 time);
99 
101  static int GetSecond(vtkTypeUInt64 time);
102 
104  static int GetMillisecond(vtkTypeUInt64 time);
105 
106  //BTX
107  enum {
108  ISO8601_DATETIME_MILLIS = 0,
109  ISO8601_DATETIME = 1,
110  ISO8601_DATE = 2,
111  ISO8601_TIME_MILLIS = 3,
112  ISO8601_TIME = 4
113  };
114 
115  static const int MILLIS_PER_SECOND;
116  static const int MILLIS_PER_MINUTE;
117  static const int MILLIS_PER_HOUR;
118  static const int MILLIS_PER_DAY;
119  static const int SECONDS_PER_MINUTE;
120  static const int SECONDS_PER_HOUR;
121  static const int SECONDS_PER_DAY;
122  static const int MINUTES_PER_HOUR;
123  static const int MINUTES_PER_DAY;
124  static const int HOURS_PER_DAY;
125 
127 
132  static vtkTypeUInt64 ISO8601ToTimePoint(const char* str, bool* ok = NULL);
133  //ETX
135 
137 
145  static const char* TimePointToISO8601(
146  vtkTypeUInt64, int format = ISO8601_DATETIME_MILLIS);
148 
149 protected:
152 
153 private:
154  vtkTimePointUtility(const vtkTimePointUtility&); // Not implemented.
155  void operator=(const vtkTimePointUtility&); // Not implemented.
156 };
157 
158 #endif
static const int MINUTES_PER_HOUR
static const int SECONDS_PER_MINUTE
abstract base class for most VTK objects
Definition: vtkObject.h:61
static const int MILLIS_PER_DAY
#define VTKCOMMONCORE_EXPORT
static const int MINUTES_PER_DAY
static const int MILLIS_PER_SECOND
static const int MILLIS_PER_MINUTE
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
static const int MILLIS_PER_HOUR
static const int HOURS_PER_DAY
performs common time operations
static const int SECONDS_PER_DAY
static const int SECONDS_PER_HOUR
static vtkObject * New()