Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::DateTime类 参考

日期时间类 更多...

#include <DateTime.h>

Public 类型

enum class  Policy { ONLY_CREATE , FORMAT }
 日期创建策略 更多...
 
using Ptr = std::unique_ptr<DateTime>
 

Public 成员函数

 DateTime () noexcept=default
 
 DateTime (uint64_t timestamp, int32_t utc=TIME_DEFAULT_ZONE, Policy policy=Policy::FORMAT) noexcept
 
bool isLeapYear () const noexcept
 
int32_t getYears () const noexcept
 
int32_t getMonths () const noexcept
 
int32_t getDays () const noexcept
 
int32_t getHours () const noexcept
 
int32_t getMinutes () const noexcept
 
int32_t getSeconds () const noexcept
 
int32_t getMilliseconds () const noexcept
 
int32_t getMicroseconds () const noexcept
 
int32_t getUTC () const noexcept
 
int32_t getDayOfWeek () const noexcept
 
int32_t getDayOfYear () const noexcept
 
uint64_t getTimestamp () const noexcept
 
TimeSpan operator- (const DateTime &date_time) const noexcept
 
DateTime operator- (const TimeSpan &time_span) const noexcept
 
DateTime operator+ (const TimeSpan &time_span) const noexcept
 
int32_t compareTo (const DateTime &date_time) const noexcept
 精细比较
 
int32_t unclearCompareTo (const DateTime &date_time) const noexcept
 粗略比较
 

静态 Public 成员函数

static DateTime now (int32_t utc=TIME_DEFAULT_ZONE, Policy policy=Policy::FORMAT) noexcept
 
static DateTime::Ptr nowPtr (int32_t utc=TIME_DEFAULT_ZONE, Policy policy=Policy::FORMAT) noexcept
 

Private 属性

int32_t years = 1970
 
int32_t months = 1
 
int32_t days = 1
 
int32_t hours = 0
 
int32_t minutes = 0
 
int32_t seconds = 0
 
int32_t dayofweek = 0
 
int32_t dayofyear = 0
 
bool isLeap = false
 
int32_t milliseconds = 0
 
int32_t microseconds = 0
 
int32_t utc = 0
 
uint64_t timestamp = 0
 

详细描述

日期时间类

成员类型定义说明

◆ Ptr

using sese::DateTime::Ptr = std::unique_ptr<DateTime>

成员枚举类型说明

◆ Policy

enum class sese::DateTime::Policy
strong

日期创建策略

枚举值
ONLY_CREATE 

仅仅创建时间戳而不解析为人类可阅读的时间格式

FORMAT 

创建时间戳的同时解析成可阅读的格式

构造及析构函数说明

◆ DateTime() [1/2]

sese::DateTime::DateTime ( )
explicitdefaultnoexcept

◆ DateTime() [2/2]

sese::DateTime::DateTime ( uint64_t timestamp,
int32_t utc = TIME_DEFAULT_ZONE,
Policy policy = Policy::FORMAT )
explicitnoexcept

成员函数说明

◆ compareTo()

int32_t sese::DateTime::compareTo ( const DateTime & date_time) const
nodiscardnoexcept

精细比较

◆ getDayOfWeek()

int32_t sese::DateTime::getDayOfWeek ( ) const
inlinenodiscardnoexcept

引用了 dayofweek.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getDayOfYear()

int32_t sese::DateTime::getDayOfYear ( ) const
inlinenodiscardnoexcept

引用了 dayofyear.

◆ getDays()

int32_t sese::DateTime::getDays ( ) const
inlinenodiscardnoexcept

引用了 days.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getHours()

int32_t sese::DateTime::getHours ( ) const
inlinenodiscardnoexcept

引用了 hours.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getMicroseconds()

int32_t sese::DateTime::getMicroseconds ( ) const
inlinenodiscardnoexcept

引用了 microseconds.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getMilliseconds()

int32_t sese::DateTime::getMilliseconds ( ) const
inlinenodiscardnoexcept

引用了 milliseconds.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getMinutes()

int32_t sese::DateTime::getMinutes ( ) const
inlinenodiscardnoexcept

引用了 minutes.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getMonths()

int32_t sese::DateTime::getMonths ( ) const
inlinenodiscardnoexcept

引用了 months.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getSeconds()

int32_t sese::DateTime::getSeconds ( ) const
inlinenodiscardnoexcept

引用了 seconds.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getTimestamp()

uint64_t sese::DateTime::getTimestamp ( ) const
inlinenodiscardnoexcept

引用了 timestamp.

被这些函数引用 operator+() , 以及 operator-().

◆ getUTC()

int32_t sese::DateTime::getUTC ( ) const
inlinenodiscardnoexcept

引用了 utc.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ getYears()

int32_t sese::DateTime::getYears ( ) const
inlinenodiscardnoexcept

引用了 years.

被这些函数引用 sese::text::DateTimeFormatter::format().

◆ isLeapYear()

bool sese::DateTime::isLeapYear ( ) const
inlinenodiscardnoexcept

引用了 isLeap.

◆ now()

◆ nowPtr()

DateTime::Ptr sese::DateTime::nowPtr ( int32_t utc = TIME_DEFAULT_ZONE,
Policy policy = Policy::FORMAT )
staticnoexcept

◆ operator+()

DateTime sese::DateTime::operator+ ( const TimeSpan & time_span) const
noexcept

引用了 getTimestamp().

◆ operator-() [1/2]

TimeSpan sese::DateTime::operator- ( const DateTime & date_time) const
noexcept

◆ operator-() [2/2]

DateTime sese::DateTime::operator- ( const TimeSpan & time_span) const
noexcept

引用了 getTimestamp().

◆ unclearCompareTo()

int32_t sese::DateTime::unclearCompareTo ( const DateTime & date_time) const
nodiscardnoexcept

粗略比较

类成员变量说明

◆ dayofweek

int32_t sese::DateTime::dayofweek = 0
private

被这些函数引用 getDayOfWeek().

◆ dayofyear

int32_t sese::DateTime::dayofyear = 0
private

被这些函数引用 getDayOfYear().

◆ days

int32_t sese::DateTime::days = 1
private

被这些函数引用 getDays().

◆ hours

int32_t sese::DateTime::hours = 0
private

被这些函数引用 getHours().

◆ isLeap

bool sese::DateTime::isLeap = false
private

被这些函数引用 isLeapYear().

◆ microseconds

int32_t sese::DateTime::microseconds = 0
private

被这些函数引用 getMicroseconds().

◆ milliseconds

int32_t sese::DateTime::milliseconds = 0
private

被这些函数引用 getMilliseconds().

◆ minutes

int32_t sese::DateTime::minutes = 0
private

被这些函数引用 getMinutes().

◆ months

int32_t sese::DateTime::months = 1
private

被这些函数引用 getMonths().

◆ seconds

int32_t sese::DateTime::seconds = 0
private

被这些函数引用 getSeconds().

◆ timestamp

uint64_t sese::DateTime::timestamp = 0
private

被这些函数引用 getTimestamp().

◆ utc

int32_t sese::DateTime::utc = 0
private

被这些函数引用 getUTC().

◆ years

int32_t sese::DateTime::years = 1970
private

被这些函数引用 getYears().


该类的文档由以下文件生成: