// Copyright 2015, EMC, Inc.

'use strict';

module.exports = TimerFactory;

TimerFactory.$provide = 'Timer';

function TimerFactory () {
    /**
     * Wrapper for process.hrtime.
     * @constructor
     */
    function Timer () {
    }

    /**
     * Starts the timer.
     */
    Timer.prototype.start = function() {
        this.time = process.hrtime();
    };

    /**
     * Clears the timer.
     */
    Timer.prototype.clear = function() {
        this.time = undefined;
    };

    /**
     * Stops the timer and returns the difference in milliseconds.
     * @return {Number}
     */
    Timer.prototype.stop = function() {
        var diff = process.hrtime(this.time);

        return diff[0] + (diff[1] / 1000000);
    };

    return Timer;
}

@@ -675,16 +675,85 @@
 .time);%0A
+        //process.hrtime returns %5B%3Cseconds%3E, %3Cremaining nanoseconds%3E%5D
 %0A       
@@ -788,16 +788,19 @@
  1000000
+000
 );%0A    %7D

Fix nanosecond to second covertion in timer