7#ifndef BOTAN_ASN1_TIME_TYPE_H_
8#define BOTAN_ASN1_TIME_TYPE_H_
10#include <botan/asn1_obj.h>
39 int32_t cmp(
const ASN1_Time& other)
const;
64 explicit ASN1_Time(
const std::chrono::system_clock::time_point& time) {
75 std::chrono::system_clock::time_point to_std_timepoint()
const;
78 uint64_t time_since_epoch()
const;
81 ASN1_Time(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second,
ASN1_Type tag);
103BOTAN_PUBLIC_API(2, 0) bool operator==(const ASN1_Time& x, const ASN1_Time& y);
109BOTAN_PUBLIC_API(2, 0)
bool operator!=(const ASN1_Time& x, const ASN1_Time& y);
115BOTAN_PUBLIC_API(2, 0)
bool operator<=(const ASN1_Time& x, const ASN1_Time& y);
121BOTAN_PUBLIC_API(2, 0)
bool operator>=(const ASN1_Time& x, const ASN1_Time& y);
127BOTAN_PUBLIC_API(2, 0)
bool operator<(const ASN1_Time& x, const ASN1_Time& y);
133BOTAN_PUBLIC_API(2, 0)
bool operator>(const ASN1_Time& x, const ASN1_Time& y);
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_FUTURE_EXPLICIT
void decode_from(BER_Decoder &from) override
static ASN1_Time from_seconds_since_epoch(uint64_t seconds)
Create an ASN1_Time from seconds since epoch.
ASN1_Type tagging() const
Return the tag (UtcTime or GeneralizedTime) this time was encoded with.
std::string to_string() const
Return an internal string representation of the time.
static ASN1_Time from_string(std::string_view t_spec)
ASN1_Time()=default
Create an invalid ASN1_Time.
static ASN1_Time from_time_point(const std::chrono::system_clock::time_point &time)
Create a ASN1_Time from a time point.
BOTAN_FUTURE_EXPLICIT ASN1_Time(std::string_view t_spec)
Create an ASN1_Time from string.
bool time_is_set() const
Return if the time has been set somehow.
ASN1_Time(const std::chrono::system_clock::time_point &time)
Create a ASN1_Time from a time point.
void encode_into(DER_Encoder &to) const override
DER encode a ASN1_Time.
ASN1_Time(std::string_view t_spec, ASN1_Type tag)
Create an ASN1_Time from string and a specified tagging (Utc or Generalized).
std::string readable_string() const
Returns a human friendly string representation of no particular formatting.