> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/guiprt_2src_2html_2timestamp_8h_source.md).

# timestamp.h

[Go to the documentation of this file.](/s-adk-5.1-programmers-guide/readme/files/dir_9225c15707e5fd27b700c844799f6dc5/dir_7447c8e6446ba60664134d106c4ecb69/dir_8c13e55433a2f6247a8b0f337ff26c19/guiprt_2src_2html_2timestamp_8h.md)

```cpp
 1 // -*- Mode: C++; -*-
 2 #ifndef TIMESTAMP_H_20141009
 3 #define TIMESTAMP_H_20141009
 4 
 7 #include <time.h>
 8 
 9 #if defined _WIN32 && defined VFI_GUIPRT_SHARED_EXPORT
 10 # define DllSpec __declspec(dllexport)
 11 #elif defined __GNUC__ && defined VFI_GUIPRT_SHARED_EXPORT
 12 # define DllSpec __attribute__((visibility ("default")))
 13 #else
 14 # define DllSpec
 15 #endif
 16 
 17 #if defined(_WIN32) && !defined(_TIMESPEC_DEFINED)
 18 #define _TIMESPEC_DEFINED
 19 struct timespec {
 20  time_t tv_sec;
 21  long tv_nsec;
 22 };
 23 #endif /* _TIMESPEC_DEFINED */
 24 
 25 
 26 namespace vfihtml {
 27 #if 0
 28 }
 29 #endif
 30 
 32 class DllSpec TimeStamp: public timespec
 33 {
 34  public:
 36  static TimeStamp Clock();
 37 
 39  static TimeStamp Monotonic();
 40 
 42  class Unit_MS {};
 43 
 45  class Unit_S {};
 46 
 48  static Unit_MS MS;
 49 
 51  static Unit_S S;
 52 
 54  TimeStamp(time_t sec, long nsec);
 55 
 57  TimeStamp(char sec) { tv_sec=sec; tv_nsec=0; }
 58 
 60  TimeStamp(unsigned char sec) { tv_sec=sec; tv_nsec=0; }
 61 
 63  TimeStamp(short sec) { tv_sec=sec; tv_nsec=0; }
 64 
 66  TimeStamp(unsigned short sec) { tv_sec=sec; tv_nsec=0; }
 67 
 69  TimeStamp(int sec) { tv_sec=sec; tv_nsec=0; }
 70 
 72  TimeStamp(unsigned sec) { tv_sec=sec; tv_nsec=0; }
 73 
 75  TimeStamp(long sec=0) { tv_sec=sec; tv_nsec=0; }
 76 
 78  TimeStamp(unsigned long sec) { tv_sec=sec; tv_nsec=0; }
 79 
 81  TimeStamp(float t);
 82 
 84  TimeStamp(double t);
 85 
 87  TimeStamp &operator=(time_t sec) { tv_sec=sec; tv_nsec=0; return *this;}
 88 
 90  TimeStamp &operator=(double t);
 91 
 92  TimeStamp &operator+=(const TimeStamp &o);
 93  TimeStamp &operator-=(const TimeStamp &o);
 94 
 96  double get() const { return tv_sec+tv_nsec/1000000000.0; }
 97 
 99  void set(double t) { operator=(t); }
 100 
 102  time_t s() const { return tv_sec; }
 103 
 105  long ms() const { return tv_sec*1000+tv_nsec/1000000; }
 106 
 108  void normalize();
 109 
 111  void clear() { tv_sec=0; tv_nsec=0; }
 112 };
 113 
 114 
 116 DllSpec TimeStamp operator+(const TimeStamp &a, const TimeStamp &b);
 117 
 119 DllSpec TimeStamp operator-(const TimeStamp &a, const TimeStamp &b);
 120 
 122 inline bool operator==(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec==b.tv_sec && a.tv_nsec==b.tv_nsec; }
 123 
 125 inline bool operator!=(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec!=b.tv_sec && a.tv_nsec!=b.tv_nsec; }
 126 
 128 inline bool operator<(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec<b.tv_sec || (a.tv_sec==b.tv_sec && a.tv_nsec<b.tv_nsec); }
 129 
 131 inline bool operator<=(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec<b.tv_sec || (a.tv_sec==b.tv_sec && a.tv_nsec<=b.tv_nsec); }
 132 
 134 inline bool operator>(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec>b.tv_sec || (a.tv_sec==b.tv_sec && a.tv_nsec>b.tv_nsec); }
 135 
 137 inline bool operator>=(const TimeStamp &a, const TimeStamp &b) { return a.tv_sec>b.tv_sec || (a.tv_sec==b.tv_sec && a.tv_nsec>=b.tv_nsec); }
 138 
 140 inline TimeStamp operator*(int t, TimeStamp::Unit_MS) {
 141  return TimeStamp(t/1000,t%1000*1000000);
 142 }
 143 
 145 inline TimeStamp operator*(int t, TimeStamp::Unit_S) {
 146  return TimeStamp(t,0);
 147 }
 148 
 149 
 150 } // namespace
 151 
 152 #undef DllSpec
 153 
 154 #endif
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/guiprt_2src_2html_2timestamp_8h_source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
