https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 7e4176185aa3b8a7ba4b8498e2c8852bb4f79714 authored by seabld on 13 April 2012, 02:26:42 UTC
Added tag SEAMONKEY_2_9b3_RELEASE for changeset FIREFOX_12_0b5_BUILD1. CLOSED TREE a=release
Tip revision: 7e41761
TelemetryTimestamps.jsm
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

let EXPORTED_SYMBOLS = ["TelemetryTimestamps"];

let TelemetryTimestamps = {
  timeStamps: {},
  add: function TT_add(name, value) {
    // Default to "now" if not specified
    if (value == null)
      value = Date.now();

    if (isNaN(value))
      throw new Error("Value must be a timestamp");

    // If there's an existing value, just ignore the new value.
    if (this.timeStamps.hasOwnProperty(name))
      return;

    this.timeStamps[name] = value;
  },
  get: function TT_get() {
    return JSON.parse(JSON.stringify(this.timeStamps));
  }
};
back to top