aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/calendar.cpp (renamed from src/utils/time.cpp)58
-rw-r--r--src/utils/calendar.h (renamed from src/utils/time.h)11
-rw-r--r--src/utils/info.txt4
3 files changed, 7 insertions, 66 deletions
diff --git a/src/utils/time.cpp b/src/utils/calendar.cpp
index d5b74828b..a51ef876c 100644
--- a/src/utils/time.cpp
+++ b/src/utils/calendar.cpp
@@ -1,36 +1,14 @@
/*
-* Time Functions
+* Calendar Functions
* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
-#include <botan/time.h>
+#include <botan/calendar.h>
#include <botan/exceptn.h>
#include <ctime>
-#if defined(BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME)
- #include <windows.h>
-#endif
-
-#if defined(BOTAN_TARGET_OS_HAS_GETTIMEOFDAY)
- #include <sys/time.h>
-#endif
-
-#if defined(BOTAN_TARGET_OS_HAS_CLOCK_GETTIME)
-
- #ifndef _POSIX_C_SOURCE
- #define _POSIX_C_SOURCE 199309
- #endif
-
- #include <time.h>
-
- #ifndef CLOCK_REALTIME
- #define CLOCK_REALTIME 0
- #endif
-
-#endif
-
namespace Botan {
namespace {
@@ -83,36 +61,4 @@ calendar_point calendar_value(
tm.tm_sec);
}
-u64bit get_nanoseconds_clock()
- {
-#if defined(BOTAN_TARGET_OS_HAS_CLOCK_GETTIME)
-
- struct ::timespec tv;
- ::clock_gettime(CLOCK_REALTIME, &tv);
- return combine_timers(tv.tv_sec, tv.tv_nsec, 1000000000);
-
-#elif defined(BOTAN_TARGET_OS_HAS_GETTIMEOFDAY)
-
- struct ::timeval tv;
- ::gettimeofday(&tv, 0);
- return combine_timers(tv.tv_sec, tv.tv_usec, 1000000);
-
-#elif defined(BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME)
-
- // Returns time since January 1, 1601 in 100-ns increments
- ::FILETIME tv;
- ::GetSystemTimeAsFileTime(&tv);
- u64bit tstamp = (static_cast<u64bit>(tv.dwHighDateTime) << 32) |
- tv.dwLowDateTime;
-
- return (tstamp * 100); // Scale to 1 nanosecond units
-
-#else
-
- return combine_timers(static_cast<u32bit>(std::time(0)),
- std::clock(), CLOCKS_PER_SEC);
-
-#endif
- }
-
}
diff --git a/src/utils/time.h b/src/utils/calendar.h
index 516efba3e..d617cc9a0 100644
--- a/src/utils/time.h
+++ b/src/utils/calendar.h
@@ -1,12 +1,12 @@
/*
-* Time Functions
+* Calendar Functions
* (C) 1999-2009 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
-#ifndef BOTAN_TIME_H__
-#define BOTAN_TIME_H__
+#ifndef BOTAN_CALENDAR_H__
+#define BOTAN_CALENDAR_H__
#include <botan/types.h>
#include <chrono>
@@ -58,11 +58,6 @@ struct BOTAN_DLL calendar_point
BOTAN_DLL calendar_point calendar_value(
const std::chrono::system_clock::time_point& time_point);
-/**
-* @return nanoseconds resolution timestamp, unknown epoch
-*/
-BOTAN_DLL u64bit get_nanoseconds_clock();
-
}
#endif
diff --git a/src/utils/info.txt b/src/utils/info.txt
index 4350ed410..e2ffd2714 100644
--- a/src/utils/info.txt
+++ b/src/utils/info.txt
@@ -4,11 +4,11 @@ load_on always
<source>
assert.cpp
+calendar.cpp
charset.cpp
cpuid.cpp
mlock.cpp
parsing.cpp
-time.cpp
version.cpp
</source>
@@ -24,6 +24,7 @@ xor_buf.h
<header:public>
bswap.h
+calendar.h
charset.h
cpuid.h
exceptn.h
@@ -31,7 +32,6 @@ loadstor.h
mem_ops.h
parsing.h
rotate.h
-time.h
types.h
version.h
get_byte.h