XII Release 0.1.0
Loading...
Searching...
No Matches
xiiTimestamp Class Reference

#include <Timestamp.h>

Classes

struct  CompareMode

Public Member Functions

 XII_DECLARE_POD_TYPE ()
 xiiTimestamp ()
 Creates an invalidated timestamp.
bool IsValid () const
 Returns whether the timestamp is valid.
xiiInt64 GetInt64 (xiiSIUnitOfTime::Enum unitOfTime) const
 Returns the number of 'unitOfTime' since Unix epoch.
bool Compare (const xiiTimestamp &rhs, CompareMode::Enum mode) const
void operator+= (const xiiTime &timeSpan)
 Adds the time value of "timeSpan" to this data value.
void operator-= (const xiiTime &timeSpan)
 Subtracts the time value of "timeSpan" from this date value.
const xiiTime operator- (const xiiTimestamp &other) const
 Returns the time span between this timestamp and "other".
const xiiTimestamp operator+ (const xiiTime &timeSpan) const
 Returns a timestamp that is "timeSpan" further into the future from this timestamp.
const xiiTimestamp operator- (const xiiTime &timeSpan) const
 Returns a timestamp that is "timeSpan" further into the past from this timestamp.

Static Public Member Functions

static const xiiTimestamp CurrentTimestamp ()
 Copyright (c) Theophilus Eriata. All Rights Reserved.
static xiiTimestamp MakeInvalid ()
 Returns an invalid timestamp.
static xiiTimestamp MakeFromInt (xiiInt64 iTimeValue, xiiSIUnitOfTime::Enum unitOfTime)
 Returns a timestamp initialized from 'iTimeValue' in 'unitOfTime' since Unix epoch.

Detailed Description

The timestamp class encapsulates a date in time as microseconds since Unix epoch.

The value is represented by a xiiInt64 and allows storing time stamps from roughly -291030 BC to 293970 AC.

Use this class to efficiently store a timestamp that is valid across platforms.

Constructor & Destructor Documentation

◆ xiiTimestamp()

xiiTimestamp::xiiTimestamp ( )
inlinedefault

Creates an invalidated timestamp.

Copyright (c) Theophilus Eriata. All Rights Reserved.

Member Function Documentation

◆ Compare()

bool xiiTimestamp::Compare ( const xiiTimestamp & rhs,
CompareMode::Enum mode ) const

Returns whether this timestamp is considered equal to 'rhs' in the given mode.

Use CompareMode::FileTime when working with file time stamps across platforms. It will use the lowest resolution supported by all platforms to make sure the timestamp of a file is considered equal regardless on which platform it was retrieved.

◆ CurrentTimestamp()

const xiiTimestamp xiiTimestamp::CurrentTimestamp ( )
static

Copyright (c) Theophilus Eriata. All Rights Reserved.

Returns the current timestamp. Returned value will always be valid.

Depending on the platform the precision varies between seconds and nanoseconds.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Time/Timestamp.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Platform/Implementation/OSX/Timestamp_osx.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Platform/Implementation/Posix/Timestamp_posix.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Platform/Implementation/Windows/Timestamp_win.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Time/Implementation/Timestamp.cpp
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Time/Implementation/Timestamp_inl.h