fm.liveswitch.UnixTimestamp Class Reference

Utility class to assist with Unix timestamp conversions. More...

Public Member Functions

 UnixTimestamp ()
 

Static Public Member Functions

static long dateTimeToUnix (java.util.Date dateTime)
 Converts a date to a Unix timestamp. More...
 
static long dateTimeToUnixMillis (java.util.Date dateTime)
 Converts a date to a Unix timestamp with millisecond precision. More...
 
static long getUtcNow ()
 Gets the current UTC time in Unix format. More...
 
static long getUtcNowMillis ()
 Gets the current UTC time in Unix format with millisecond precision. More...
 
static long ticksToUnix (long ticks)
 Converts ticks to a Unix timestamp. More...
 
static long ticksToUnixMillis (long ticks)
 Converts ticks to a Unix timestamp with millisecond precision. More...
 
static java.util.Date unixMillisToDateTime (long unix)
 Converts a Unix timestamp with millisecond precision to a date. More...
 
static long unixMillisToTicks (long unix)
 Converts a Unix timestamp with millisecond precision to ticks. More...
 
static java.util.Date unixToDateTime (long unix)
 Converts a Unix timestamp to a date. More...
 
static long unixToTicks (long unix)
 Converts a Unix timestamp to ticks. More...
 

Detailed Description

Utility class to assist with Unix timestamp conversions.

Constructor & Destructor Documentation

◆ UnixTimestamp()

fm.liveswitch.UnixTimestamp.UnixTimestamp ( )

Member Function Documentation

◆ dateTimeToUnix()

static long fm.liveswitch.UnixTimestamp.dateTimeToUnix ( java.util.Date  dateTime)
static

Converts a date to a Unix timestamp.

Parameters
dateTimeThe date to convert.
Returns
The equivalent Unix timestamp.

◆ dateTimeToUnixMillis()

static long fm.liveswitch.UnixTimestamp.dateTimeToUnixMillis ( java.util.Date  dateTime)
static

Converts a date to a Unix timestamp with millisecond precision.

Parameters
dateTimeThe date to convert.
Returns
The equivalent Unix timestamp.

◆ getUtcNow()

static long fm.liveswitch.UnixTimestamp.getUtcNow ( )
static

Gets the current UTC time in Unix format.

◆ getUtcNowMillis()

static long fm.liveswitch.UnixTimestamp.getUtcNowMillis ( )
static

Gets the current UTC time in Unix format with millisecond precision.

◆ ticksToUnix()

static long fm.liveswitch.UnixTimestamp.ticksToUnix ( long  ticks)
static

Converts ticks to a Unix timestamp.

Parameters
ticksThe ticks to convert.
Returns
The equivalent Unix timestamp.

◆ ticksToUnixMillis()

static long fm.liveswitch.UnixTimestamp.ticksToUnixMillis ( long  ticks)
static

Converts ticks to a Unix timestamp with millisecond precision.

Parameters
ticksThe ticks to convert.
Returns
The equivalent Unix timestamp.

◆ unixMillisToDateTime()

static java.util.Date fm.liveswitch.UnixTimestamp.unixMillisToDateTime ( long  unix)
static

Converts a Unix timestamp with millisecond precision to a date.

Parameters
unixThe Unix timestamp to convert.
Returns
The equivalent date.

◆ unixMillisToTicks()

static long fm.liveswitch.UnixTimestamp.unixMillisToTicks ( long  unix)
static

Converts a Unix timestamp with millisecond precision to ticks.

Parameters
unixThe Unix timestamp to convert.
Returns
The equivalent ticks.

◆ unixToDateTime()

static java.util.Date fm.liveswitch.UnixTimestamp.unixToDateTime ( long  unix)
static

Converts a Unix timestamp to a date.

Parameters
unixThe Unix timestamp to convert.
Returns
The equivalent date.

◆ unixToTicks()

static long fm.liveswitch.UnixTimestamp.unixToTicks ( long  unix)
static

Converts a Unix timestamp to ticks.

Parameters
unixThe Unix timestamp to convert.
Returns
The equivalent ticks.