# Namespace: CB_Device

## CB_Device

Static class to manage the device. It will return itself if it is tried to be instantiated.

Source:
  - CrossBase/device/CB_Device.js, line 13
To Do:
  - Think about defining a parameter on many of the events to disable automatic normalization of the event object.

### Namespaces

AmbientLight
Battery
Location
Motion
Orientation
Proximity
Vibration

### Methods

#### <static> getTime() → {integer}

  Gets a timestamp in milliseconds (elapsed since 1st of January 1970 00:00:00 UTC) representing the current time. Using high precision if the `CB_Configuration.CrossBase.CB_Device_getTime_HIGH_PRECISION` option is true (it would return 'window.performance.timing.navigationStart + window.performance.now()', where 'window.performance.now' could be polyfilled) or normal precision otherwise (it would return 'Date.now()', where 'Date.now' could be polyfilled).

  Source:
    - CrossBase/device/CB_Device.js, line 47

  ##### Returns:

  Returns a timestamp in milliseconds (elapsed since 1st of January 1970 00:00:00 UTC) representing the current time or zero (0) if it was not possible.

  Type
    integer

#### <static> getTiming() → {number}

  Gets the time elapsed since the time origin. If possible, it uses window.performance.now, which could be polyfilled (if it is polyfilled it will not have high precision timing but, if it is not, time precision/resolution will depend on the client).

  Source:
    - CrossBase/device/CB_Device.js, line 58

  ##### Returns:

  Returns the time elapsed since the time origin. If possible, it uses window.performance.now, which could be polyfilled (if it is polyfilled it will not have high precision timing but, if it is not, time precision/resolution will depend on the client).

  Type
    number

#### Search results