Show / Hide Table of Contents

Class Ticks

Contains methods for manipulating time when it is represented in ticks (ten-millionths of a second).

Inheritance
System.Object
Ticks
Namespace: FFT.TimeStamps
Assembly: FFT.TimeStamps.dll
Syntax
public static class Ticks : object

Methods

| Improve this Doc View Source

AddDays(Int64, Double)

Adds the given number of days.

Declaration
public static long AddDays(this long ticks, double days)
Parameters
Type Name Description
System.Int64 ticks
System.Double days
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddDays(Int64, Int64)

Adds the given number of days.

Declaration
public static long AddDays(this long ticks, long days)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 days
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddHours(Int64, Double)

Adds the given number of hours.

Declaration
public static long AddHours(this long ticks, double hours)
Parameters
Type Name Description
System.Int64 ticks
System.Double hours
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddHours(Int64, Int64)

Adds the given number of hours.

Declaration
public static long AddHours(this long ticks, long hours)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 hours
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddMilliseconds(Int64, Double)

Adds the given number of milliseconds.

Declaration
public static long AddMilliseconds(this long ticks, double milliseconds)
Parameters
Type Name Description
System.Int64 ticks
System.Double milliseconds
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddMilliseconds(Int64, Int64)

Adds the given number of milliseconds.

Declaration
public static long AddMilliseconds(this long ticks, long milliseconds)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 milliseconds
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddMinutes(Int64, Double)

Adds the given number of minutes.

Declaration
public static long AddMinutes(this long ticks, double minutes)
Parameters
Type Name Description
System.Int64 ticks
System.Double minutes
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddMinutes(Int64, Int64)

Adds the given number of minutes.

Declaration
public static long AddMinutes(this long ticks, long minutes)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 minutes
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddSeconds(Int64, Double)

Adds the given number of seconds.

Declaration
public static long AddSeconds(this long ticks, double seconds)
Parameters
Type Name Description
System.Int64 ticks
System.Double seconds
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddSeconds(Int64, Int64)

Adds the given number of seconds.

Declaration
public static long AddSeconds(this long ticks, long seconds)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 seconds
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddWeeks(Int64, Double)

Adds the given number of weeks.

Declaration
public static long AddWeeks(this long ticks, double weeks)
Parameters
Type Name Description
System.Int64 ticks
System.Double weeks
Returns
Type Description
System.Int64
| Improve this Doc View Source

AddWeeks(Int64, Int64)

Adds the given number of weeks.

Declaration
public static long AddWeeks(this long ticks, long weeks)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 weeks
Returns
Type Description
System.Int64
| Improve this Doc View Source

At(Int32, Int32, Int32)

Calculates the ticks at the given moment in time.

Declaration
public static long At(int year, int month, int day)
Parameters
Type Name Description
System.Int32 year
System.Int32 month
System.Int32 day
Returns
Type Description
System.Int64
| Improve this Doc View Source

At(Int32, Int32, Int32, Int32, Int32, Int32)

Calculates the ticks at the given moment in time.

Declaration
public static long At(int year, int month, int day, int hour, int minute, int second)
Parameters
Type Name Description
System.Int32 year
System.Int32 month
System.Int32 day
System.Int32 hour
System.Int32 minute
System.Int32 second
Returns
Type Description
System.Int64
| Improve this Doc View Source

FromUnixMilliseconds(Int64)

Converts the given unix time to ticks.

Declaration
public static long FromUnixMilliseconds(this long unixMilliseconds)
Parameters
Type Name Description
System.Int64 unixMilliseconds

The time since midnight, 1 Jan 1970, in milliseconds.

Returns
Type Description
System.Int64
| Improve this Doc View Source

FromUnixSeconds(Int64)

Converts the given unix time to ticks.

Declaration
public static long FromUnixSeconds(this long unixSeconds)
Parameters
Type Name Description
System.Int64 unixSeconds

The time since midnight, 1 Jan 1970, in seconds.

Returns
Type Description
System.Int64
| Improve this Doc View Source

GetNext(Int64, TimeOfWeek)

Calculates and returns the moment at timeOfWeek that first occurs at or after ticks.

Declaration
public static long GetNext(this long ticks, TimeOfWeek timeOfWeek)
Parameters
Type Name Description
System.Int64 ticks
TimeOfWeek timeOfWeek
Returns
Type Description
System.Int64
| Improve this Doc View Source

GetNext(Int64, TimeSpan)

Calculates and returns the moment at timeOfDay that first occurs at or after ticks.

Declaration
public static long GetNext(this long ticks, TimeSpan timeOfDay)
Parameters
Type Name Description
System.Int64 ticks
TimeSpan timeOfDay
Returns
Type Description
System.Int64
| Improve this Doc View Source

GetPrevious(Int64, TimeOfWeek)

Calculates and returns the moment at timeOfWeek that mostly recently occurs at or before ticks.

Declaration
public static long GetPrevious(this long ticks, TimeOfWeek timeOfWeek)
Parameters
Type Name Description
System.Int64 ticks
TimeOfWeek timeOfWeek
Returns
Type Description
System.Int64
| Improve this Doc View Source

GetPrevious(Int64, TimeSpan)

Calculates and returns the moment at timeOfDay that mostly recently occurs at or before ticks.

Declaration
public static long GetPrevious(this long ticks, TimeSpan timeOfDay)
Parameters
Type Name Description
System.Int64 ticks
TimeSpan timeOfDay
Returns
Type Description
System.Int64
| Improve this Doc View Source

TicksPastDay(Int64)

Gets the number of ticks that have elapsed since the beginning of the day. Beginning of the day is considered to be midnight.

Declaration
public static long TicksPastDay(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

TicksPastWeek(Int64)

Gets the number of ticks that have elapsed since the beginning of the week. Beginning of the week is considered to be midnight, Sunday.

Declaration
public static long TicksPastWeek(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToDayCeiling(Int64)

Rounds the given value up to the beginning of the next day. If the given value is already at the beginning of the day, a copy of the value is returned.

Declaration
public static long ToDayCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToDayFloor(Int64)

Rounds the given value down to the beginning of the day.

Declaration
public static long ToDayFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToDayOfWeek(Int64)

Gets the for the given ticks.

Declaration
public static DayOfWeek ToDayOfWeek(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
DayOfWeek
| Improve this Doc View Source

ToDays(Int64)

Calculates the total number of days represented by the given ticks.

Declaration
public static double ToDays(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Double
| Improve this Doc View Source

ToHourCeiling(Int64)

Rounds the given value up to the beginning of the next hour. If the given value is already at the beginning of the hour, a copy of the value is returned.

Declaration
public static long ToHourCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToHourFloor(Int64)

Rounds the given value down to the beginning of the hour.

Declaration
public static long ToHourFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToHours(Int64)

Calculates the total number of hours represented by the given ticks.

Declaration
public static double ToHours(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Double
| Improve this Doc View Source

ToIntervalCeiling(Int64, Int64, Int64)

Divides time from intervalStart into evenly-sized periods (intervals) of length intervalLength and returns the beginning of the next interval to start after ticks. If the ticks is at an exact interval start, it returns a copy of the same ticks.

Declaration
public static long ToIntervalCeiling(this long ticks, long intervalStart, long intervalLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 intervalStart
System.Int64 intervalLength
Returns
Type Description
System.Int64
Remarks

You will get unexpected results if ticks is less than intervalStart or if intervalLength is less than or equal to zero.

| Improve this Doc View Source

ToIntervalFloor(Int64, Int64, Int64)

Divides time from intervalStart into evenly-sized periods (intervals) of length intervalLength and returns the beginning of the interval in progress at ticks. If the ticks is at an exact interval start, it returns a copy of the same ticks.

Declaration
public static long ToIntervalFloor(this long ticks, long intervalStart, long intervalLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 intervalStart
System.Int64 intervalLength
Returns
Type Description
System.Int64
Remarks

You will get unexpected results if ticks is less than intervalStart or if intervalLength is less than or equal to zero.

| Improve this Doc View Source

ToIntervalIndex(Int64, Int64, Int64)

Divides time from intervalStart into evenly-sized periods (intervals) of length intervalLength Calculates the zero-based index of the interval in progress.

Declaration
public static int ToIntervalIndex(this long ticks, long intervalStart, long intervalLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 intervalStart
System.Int64 intervalLength
Returns
Type Description
System.Int32
Remarks

You will get unexpected results if ticks is less than intervalStart or if intervalLength is less than or equal to zero.

| Improve this Doc View Source

ToMillisecondFloor(Int64)

Rounds the given value down to the beginning of the millisecond.

Declaration
public static long ToMillisecondFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToMilliseconds(Int64)

Calculates the total number of milliseconds represented by the given ticks.

Declaration
public static double ToMilliseconds(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Double
| Improve this Doc View Source

ToMillisecondsCeiling(Int64)

Rounds the given value up to the beginning of the next millisecond. If the given value is already at the beginning of the millisecond, a copy of the value is returned.

Declaration
public static long ToMillisecondsCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToMinuteCeiling(Int64)

Rounds the given value up to the beginning of the next minute. If the given value is already at the beginning of the minute, a copy of the value is returned.

Declaration
public static long ToMinuteCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToMinuteFloor(Int64)

Rounds the given value down to the beginning of the minute.

Declaration
public static long ToMinuteFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToMinuteOfDayIndex(Int64)

Rounds the minute down to the start of the minute and then returns the zero-based index of the minute within the day. Values returned range from 0 to 1439 The zero point is midnight, Sunday.

Declaration
public static int ToMinuteOfDayIndex(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToMinuteOfWeekIndex(Int64)

Rounds the minute down to the start of the minute and then returns zero-based index of the minute within the week. Values returned range from 0 to 7 * 1440 - 1. The zero point is midnight, Sunday.

Declaration
public static int ToMinuteOfWeekIndex(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToMinutes(Int64)

Calculates the total number of minutes represented by the given ticks.

Declaration
public static double ToMinutes(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Double
| Improve this Doc View Source

ToPeriodOfWeekCeiling(Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the beginning of the period after the given time ticks. Beginning of the first period is considered to be midnight, Sunday. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLengthInMinutes * TimeSpan.TicksPerMinute) If the timestamp is at an exact period start, it returns a copy of the same timestamp.

Declaration
public static long ToPeriodOfWeekCeiling(this long ticks, long periodLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToPeriodOfWeekCeiling(Int64, Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the beginning of the period after the given time ticks. Beginning of the first period is considered to be midnight, Sunday, PLUS periodOffset. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLengthInMinutes * TimeSpan.TicksPerMinute) If the timestamp is at an exact period start, it returns a copy of the same timestamp.

Declaration
public static long ToPeriodOfWeekCeiling(this long ticks, long periodLength, long periodOffset)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
System.Int64 periodOffset
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToPeriodOfWeekFloor(Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the beginning of the period at given time ticks. Beginning of the first period is considered to be midnight, Sunday. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLengthInMinutes * TimeSpan.TicksPerMinute) If the timestamp is at an exact period start, it returns a copy of the same timestamp.

Declaration
public static long ToPeriodOfWeekFloor(this long ticks, long periodLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToPeriodOfWeekFloor(Int64, Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the beginning of the period at given time ticks. Beginning of the first period is considered to be midnight, Sunday, PLUS periodOffset. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLengthInMinutes * TimeSpan.TicksPerMinute) If the timestamp is at an exact period start, it returns a copy of the same timestamp.

Declaration
public static long ToPeriodOfWeekFloor(this long ticks, long periodLength, long periodOffset)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
System.Int64 periodOffset
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToPeriodOfWeekIndex(Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the zero-based index of the period at given time ticks. Beginning of the first period is considered to be midnight, Sunday. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLength).

Declaration
public static int ToPeriodOfWeekIndex(this long ticks, long periodLength)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToPeriodOfWeekIndex(Int64, Int64, Int64)

Divides the week into periods of length periodLength, and then calculates the zero-based index of the period at given time ticks. Beginning of the first period is considered to be midnight, Sunday, PLUS periodOffset. Periods include the first tick (index == 0) and exclude the the first tick of the next period (index < periodLength).

Declaration
public static int ToPeriodOfWeekIndex(this long ticks, long periodLength, long periodOffset)
Parameters
Type Name Description
System.Int64 ticks
System.Int64 periodLength
System.Int64 periodOffset
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToSecondCeiling(Int64)

Rounds the given value up to the beginning of the next second. If the given value is already at the beginning of the second, a copy of the value is returned.

Declaration
public static long ToSecondCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToSecondFloor(Int64)

Rounds the given value down to the beginning of the second.

Declaration
public static long ToSecondFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToSecondOfDayIndex(Int64)

Rounds the second down to the start of the second and then returns zero-based index of the second within the day. Values returned range from 0 to 1440 * 60 - 1.

Declaration
public static int ToSecondOfDayIndex(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToSecondOfWeekIndex(Int64)

Rounds the second down to the start of the second and then returns zero-based index of the second within the week. Values returned range from 0 to 7 * 1440 * 60 - 1. The zero point is midnight, Sunday.

Declaration
public static int ToSecondOfWeekIndex(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int32
| Improve this Doc View Source

ToSeconds(Int64)

Calculates the total number of seconds represented by the given ticks.

Declaration
public static double ToSeconds(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Double
| Improve this Doc View Source

ToTimeOfDay(Int64)

Gets the time of day for the given ticks.

Declaration
public static TimeSpan ToTimeOfDay(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
TimeSpan
| Improve this Doc View Source

ToTimeOfWeek(Int64)

Gets the TimeOfWeek for the given ticks.

Declaration
public static TimeOfWeek ToTimeOfWeek(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
TimeOfWeek
| Improve this Doc View Source

ToTimeSpan(Int64)

Converts the given ticks to an equivalent .

Declaration
public static TimeSpan ToTimeSpan(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
TimeSpan
| Improve this Doc View Source

ToTimeStamp(Int64)

Converts the given ticks to an equivalent TimeStamp.

Declaration
public static TimeStamp ToTimeStamp(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
TimeStamp
| Improve this Doc View Source

ToUnixMilliseconds(Int64)

Gets the number of milliseconds since Midnight, 1 January 1970, UTC.

Declaration
public static long ToUnixMilliseconds(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToUnixSeconds(Int64)

Gets the number of seconds since Midnight, 1 January 1970, UTC.

Declaration
public static long ToUnixSeconds(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToWeekCeiling(Int64)

Rounds the given value up to the beginning of the next week. If the given value is already at the beginning of the week, a copy of the value is returned. Week ceiling is considered midnight, Sunday.

Declaration
public static long ToWeekCeiling(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
| Improve this Doc View Source

ToWeekFloor(Int64)

Rounds the given value down to the beginning of the week. Week floor is considered midnight, Sunday.

Declaration
public static long ToWeekFloor(this long ticks)
Parameters
Type Name Description
System.Int64 ticks
Returns
Type Description
System.Int64
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX