/usr/include/dcmtk/oflog/helpers/timehelp.h is in libdcmtk-dev 3.6.2-3build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | // -*- C++ -*-
// Module: Log4CPLUS
// File: timehelper.h
// Created: 6/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2010 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef DCMTK_LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_
#define DCMTK_LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_
#include "dcmtk/oflog/config.h"
#if defined (DCMTK_LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include "dcmtk/oflog/tstring.h"
#if defined (DCMTK_LOG4CPLUS_HAVE_TIME_H)
#include <time.h>
#endif
#include <ctime>
namespace dcmtk {
namespace log4cplus {
namespace helpers {
#if 0 // Needed for MSC6
using STD_NAMESPACE time_t;
using STD_NAMESPACE tm;
#endif
/**
* This class represents a Epoch time with microsecond accuracy.
*/
class DCMTK_LOG4CPLUS_EXPORT Time {
public:
Time();
Time(time_t tv_sec, long tv_usec);
explicit Time(time_t time);
/**
* Returns the current time using the <code>gettimeofday()</code>
* method if it is available on the current platform. (Not on
* WIN32.)
*/
static Time gettimeofday();
// Methods
/**
* Returns <i>seconds</i> value.
*/
time_t sec() const { return tv_sec; }
/**
* Returns <i>microseconds</i> value.
*/
long usec() const { return tv_usec; }
/**
* Sets the <i>seconds</i> value.
*/
void sec(time_t s) { tv_sec = s; }
/**
* Sets the <i>microseconds</i> value.
*/
void usec(long us) { tv_usec = us; }
/**
* Sets this Time using the <code>mktime</code> function.
*/
time_t setTime(tm* t);
/**
* Returns this Time as a <code>time_t</code> value.
*/
time_t getTime() const DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
/**
* Populates <code>tm</code> using the <code>gmtime()</code>
* function.
*/
void gmtime(tm* t) const;
/**
* Populates <code>tm</code> using the <code>localtime()</code>
* function.
*/
void localtime(tm* t) const;
/**
* Returns a string with a "formatted time" specified by
* <code>fmt</code>. It used the <code>strftime()</code>
* function to do this.
*
* Look at your platform's <code>strftime()</code> documentation
* for the formatting options available.
*
* The following additional options are provided:<br>
* <code>%q</code> - 3 character field that provides milliseconds
* <code>%Q</code> - 7 character field that provides fractional
* milliseconds.
*/
log4cplus::tstring getFormattedTime(const log4cplus::tstring& fmt,
bool use_gmtime = false) const;
// Operators
Time& operator+=(const Time& rhs);
Time& operator-=(const Time& rhs);
Time& operator/=(long rhs);
Time& operator*=(long rhs);
private:
// Data
time_t tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
DCMTK_LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator+
(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs);
DCMTK_LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator-
(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs);
DCMTK_LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator/
(const log4cplus::helpers::Time& lhs,
long rhs);
DCMTK_LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator*
(const log4cplus::helpers::Time& lhs,
long rhs);
DCMTK_LOG4CPLUS_EXPORT bool operator<(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
DCMTK_LOG4CPLUS_EXPORT bool operator<=(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
DCMTK_LOG4CPLUS_EXPORT bool operator>(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
DCMTK_LOG4CPLUS_EXPORT bool operator>=(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
DCMTK_LOG4CPLUS_EXPORT bool operator==(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
DCMTK_LOG4CPLUS_EXPORT bool operator!=(const log4cplus::helpers::Time& lhs,
const log4cplus::helpers::Time& rhs)
DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
} // namespace helpers
} // namespace log4cplus
} // end namespace dcmtk
#endif // DCMTK_LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_
|