Agora Java API Reference for Android
Public Member Functions | Static Public Attributes | List of all members
agora::base::NtpTime Class Reference

Public Member Functions

 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
 

Member Function Documentation

◆ Ms()

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

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

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

Gets the integer part of the NTP timestamp.

Returns
  • An uint32_t value.

◆ ToFractions()

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

Gets the fractional part of the NTP timestamp.

Returns
  • An uint32_t value.

◆ ToTimestamp()

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

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.