CatapultServer  v0.5.0.1 (Elephant)
NetworkTime.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 #include <chrono>
24 
25 namespace catapult { namespace utils {
26 
27  // Note: a network timestamp is represented as the number of milliseconds since the Epoch_Time.
28  // a unix timestamp is represented as the number of milliseconds since 1970-01-01 00:00:00 UTC.
29 
31  constexpr auto Epoch_Time = std::chrono::duration<int64_t, std::milli>(1459468800000);
32 
35 
38  Timestamp ToNetworkTime(const Timestamp& timestamp);
39 
42  Timestamp ToUnixTime(const Timestamp& timestamp);
43 }}
catapult::utils::Epoch_Time
constexpr auto Epoch_Time
Represents the number of milliseconds between 1970-01-01 00:00:00 UTC and 2016-04-01 00:00:00 UTC.
Definition: NetworkTime.h:31
catapult::utils::ToNetworkTime
Timestamp ToNetworkTime(const Timestamp &timestamp)
Definition: NetworkTime.cpp:33
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::utils::ToUnixTime
Timestamp ToUnixTime(const Timestamp &timestamp)
Definition: NetworkTime.cpp:40
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
types.h
catapult::Timestamp
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
Casting.h
NetworkTime.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::NetworkTime
Timestamp NetworkTime()
Returns the network time, i.e. the number of milliseconds since Epoch_Time.
Definition: NetworkTime.cpp:27