Home Reference Source Test
import {Timetag} from 'osc-js/src/atomic/timetag.js'
public class | source

Timetag

Timetag helper class for representing NTP timestamps and conversion between them and javascript representation

Test:

Constructor Summary

Public Constructor
public

constructor(seconds: number, fractions: number)

Create a Timetag instance

Member Summary

Public Members
public
public

Method Summary

Public Methods
public

timestamp(milliseconds: number): number

Converts from NTP to JS representation and back

Public Constructors

public constructor(seconds: number, fractions: number) source

Create a Timetag instance

Params:

NameTypeAttributeDescription
seconds number
  • optional
  • default: 0

Initial NTP seconds value

fractions number
  • optional
  • default: 0

Initial NTP fractions value

Public Members

public fractions: number source

public seconds: number source

Public Methods

public timestamp(milliseconds: number): number source

Converts from NTP to JS representation and back

Params:

NameTypeAttributeDescription
milliseconds number
  • optional

Converts from JS milliseconds to NTP. Leave empty for converting from NTP to JavaScript representation

Return:

number

Javascript timestamp

Test: