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 "vtkObject.h"
34 
36 {
37 public:
38  static vtkTimePointUtility *New();
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
43 
44  static vtkTypeUInt64 DateToTimePoint(
45  int year, int month, int day);
47 
49 
51  static vtkTypeUInt64 TimeToTimePoint(
52  int hour, int minute, int second, int millis = 0);
54 
56 
57  static vtkTypeUInt64 DateTimeToTimePoint(
58  int year, int month, int day,
59  int hour, int minute, int sec, int millis = 0);
61 
63 
65  static void GetDate(vtkTypeUInt64 time,
66  int& year, int& month, int& day);
68 
70 
72  static void GetTime(vtkTypeUInt64 time,
73  int& hour, int& minute, int& second, int& millis);
75 
77 
79  static void GetDateTime(vtkTypeUInt64 time,
80  int& year, int& month, int& day,
81  int& hour, int& minute, int& second, int& millis);
83 
85  static int GetYear(vtkTypeUInt64 time);
86 
88  static int GetMonth(vtkTypeUInt64 time);
89 
91  static int GetDay(vtkTypeUInt64 time);
92 
94  static int GetHour(vtkTypeUInt64 time);
95 
97  static int GetMinute(vtkTypeUInt64 time);
98 
100  static int GetSecond(vtkTypeUInt64 time);
101 
103  static int GetMillisecond(vtkTypeUInt64 time);
104 
105  //BTX
106  enum {
107  ISO8601_DATETIME_MILLIS = 0,
108  ISO8601_DATETIME = 1,
109  ISO8601_DATE = 2,
110  ISO8601_TIME_MILLIS = 3,
111  ISO8601_TIME = 4
112  };
113 
114  static const int MILLIS_PER_SECOND;
115  static const int MILLIS_PER_MINUTE;
116  static const int MILLIS_PER_HOUR;
117  static const int MILLIS_PER_DAY;
118  static const int SECONDS_PER_MINUTE;
119  static const int SECONDS_PER_HOUR;
120  static const int SECONDS_PER_DAY;
121  static const int MINUTES_PER_HOUR;
122  static const int MINUTES_PER_DAY;
123  static const int HOURS_PER_DAY;
124 
126 
131  static vtkTypeUInt64 ISO8601ToTimePoint(const char* str, bool* ok = NULL);
132  //ETX
134 
136 
144  static const char* TimePointToISO8601(
145  vtkTypeUInt64, int format = ISO8601_DATETIME_MILLIS);
147 
148 protected:
151 
152 private:
153  vtkTimePointUtility(const vtkTimePointUtility&); // Not implemented.
154  void operator=(const vtkTimePointUtility&); // Not implemented.
155 };
156 
157 #endif
static const int MINUTES_PER_HOUR
static const int SECONDS_PER_MINUTE
abstract base class for most VTK objects
Definition: vtkObject.h:60
static const int MILLIS_PER_DAY
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:37
static const int MILLIS_PER_HOUR
static const int HOURS_PER_DAY
#define VTK_COMMON_EXPORT
performs common time operations
static const int SECONDS_PER_DAY
static const int SECONDS_PER_HOUR
static vtkObject * New()