# all files / TypeScript.NET/source/System/Time/ TimeQuantity.js

61.76% Statements 21/34
25% Branches 5/20
50% Functions 5/10
64.52% Lines 20/31

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65

    1×
    1×
    1×

    1×
    1×
    1×
    1×
    7×
    7×

    1×
    2×

    1×

    1×

    1×

    1×

    1×

    1×

    1×
    1×
    1×

     /*!
     * @author electricessence / https://github.com/electricessence/
     * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md
     */
    (function (factory) {
        Eif (typeof module === 'object' && typeof module.exports === 'object') {
            var v = factory(require, exports); Iif (v !== undefined) module.exports = v;
        }
        else if (typeof define === 'function' && define.amd) {
            define(["require", "exports", "../Compare", "./TimeUnit"], factory);
        }
    })(function (require, exports) {
        "use strict";
        var Compare_1 = require("../Compare");
        var TimeUnit_1 = require("./TimeUnit");
        var TimeQuantity = (function () {
            function TimeQuantity(_quantity) {
                Iif (_quantity === void 0) { _quantity = 0; }
                this._quantity = _quantity;
            }
            TimeQuantity.prototype.getTotalMilliseconds = function () {
                return this._quantity;
            };
            Object.defineProperty(TimeQuantity.prototype, "direction", {
                get: function () {
                    return Compare_1.compare(this.getTotalMilliseconds(), 0);
                },
                enumerable: true,
                configurable: true
            });
            TimeQuantity.prototype.equals = function (other) {
                return Compare_1.areEqual(this.getTotalMilliseconds(), other && other.total && other.total.milliseconds);
            };
            TimeQuantity.prototype.compareTo = function (other) {
                return Compare_1.compare(this.getTotalMilliseconds(), other && other.total && other.total.milliseconds);
            };
            Object.defineProperty(TimeQuantity.prototype, "total", {
                get: function () {
                    var t = this._total;
                    if (!t) {
                        var ms = this.getTotalMilliseconds();
                        this._total = t = Object.freeze({
                            ticks: ms * 10000,
                            milliseconds: ms,
                            seconds: ms / 1000,
                            minutes: ms / 60000,
                            hours: ms / 3600000,
                            days: ms / 86400000,
                        });
                    }
                    return t;
                },
                enumerable: true,
                configurable: true
            });
            TimeQuantity.prototype.getTotal = function (units) {
                return TimeUnit_1.TimeUnit.fromMilliseconds(this.getTotalMilliseconds(), units);
            };
            return TimeQuantity;
        }());
        exports.TimeQuantity = TimeQuantity;
        Object.defineProperty(exports, "__esModule", { value: true });
        exports.default = TimeQuantity;
    });
    //# sourceMappingURL=TimeQuantity.js.map