Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
agora::base::NtpTime Class Reference

`#include <time_utils.h>`

## Public Member Functions
| NtpTime ()
| NtpTime (uint64_t ms)
| NtpTime (uint32_t seconds, uint32_t fractions)
| operator uint64_t () const
uint64_t | Ms () const
bool | Valid () const
uint32_t | ToSeconds () const
uint32_t | ToFractions () const
uint64_t | ToTimestamp () const

## Static Public Attributes
static const uint64_t | ntpFracPerSecond = 4294967296

## Constructor & Destructor Documentation

## ◆ NtpTime() [1/3]

agora::base::NtpTime::NtpTime | ( |  | ) |
| inline

## ◆ NtpTime() [2/3]

agora::base::NtpTime::NtpTime | ( | uint64_t | ms | ) |
| inline

## ◆ NtpTime() [3/3]

agora::base::NtpTime::NtpTime | ( | uint32_t | seconds,
|  | uint32_t | fractions )
| inline

## Member Function Documentation

## ◆ operator uint64_t()

agora::base::NtpTime::operator uint64_t | ( |  | ) | const
| inline

## ◆ Ms()

uint64_t agora::base::NtpTime::Ms | ( |  | ) | const
| inline

Gets the NTP time.

Returns
  - The wallclock time which is in milliseconds relative to 0h UTC on 1 January 1900.

## ◆ Valid()

bool agora::base::NtpTime::Valid | ( |  | ) | const
| inline

Check that whether the NtpTime object is valid

- `true`: the NtpTime object is valid.
- `false`: the NtpTime object is invalid.

## ◆ ToSeconds()

uint32_t agora::base::NtpTime::ToSeconds | ( |  | ) | const
| inline

Gets the integer part of the NTP timestamp.

Returns
  - An uint32_t value.

## ◆ ToFractions()

uint32_t agora::base::NtpTime::ToFractions | ( |  | ) | const
| inline

Gets the fractional part of the NTP timestamp.

Returns
  - An uint32_t value.

## ◆ ToTimestamp()

uint64_t agora::base::NtpTime::ToTimestamp | ( |  | ) | const
| inline

Gets the NTP timestamp.

Note
  - The full resolution NTP timestamp is a 64-bit unsigned fixed-point number with the integer part in the first 32 bits and the fractional part in the last 32 bits.

Returns
  - An uint64_t value.

## Member Data Documentation

## ◆ ntpFracPerSecond

const uint64_t agora::base::NtpTime::ntpFracPerSecond = 4294967296
| static