2020-06-10 12:42:44 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
2019-04-23 13:56:15 +01:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2020-02-14 15:35:10 +00:00
|
|
|
/**
|
2020-06-10 12:42:44 +01:00
|
|
|
* Time holds methods to operate over timestamps.
|
2020-02-14 15:35:10 +00:00
|
|
|
*/
|
2020-06-10 12:42:44 +01:00
|
|
|
export class Time {
|
|
|
|
/**
|
|
|
|
* toUnixTimestamp converts Date to unix timestamp.
|
|
|
|
* @param time
|
|
|
|
*/
|
|
|
|
public static toUnixTimestamp(time: Date): number {
|
|
|
|
return Math.floor(time.getTime() / 1000);
|
|
|
|
}
|
2019-04-23 13:56:15 +01:00
|
|
|
}
|