Show / Hide Table of Contents

Struct Time

Implements
System.IEquatable<Time>
System.IComparable<Time>
Inherited Members
System.ValueType.GetHashCode()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: TimeLib
Assembly: TimeLib.dll
Syntax
public struct Time : IEquatable<Time>, IComparable<Time>

Constructors

| Improve this Doc View Source

Time(Int32)

Declaration
public Time(int hour)
Parameters
Type Name Description
System.Int32 hour
| Improve this Doc View Source

Time(Int32, Int32)

Declaration
public Time(int hour, int minute)
Parameters
Type Name Description
System.Int32 hour
System.Int32 minute
| Improve this Doc View Source

Time(Int32, Int32, Int32)

Declaration
public Time(int hour, int minute, int second)
Parameters
Type Name Description
System.Int32 hour
System.Int32 minute
System.Int32 second
| Improve this Doc View Source

Time(String)

Create time from string.

Declaration
public Time(string time)
Parameters
Type Name Description
System.String time

Format HH:mm:ss.

Properties

| Improve this Doc View Source

Hours

Hours.

Declaration
public int Hours { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Minutes

Minutes.

Declaration
public int Minutes { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Seconds

Seconds.

Declaration
public int Seconds { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Add(TimePeriod)

Add time period to time.

Declaration
public Time Add(TimePeriod timePeriod)
Parameters
Type Name Description
TimePeriod timePeriod
Returns
Type Description
Time

Returns new time instance. When sum exceeds 24:00:00 it returns maximum 24:00:00.

| Improve this Doc View Source

CompareTo(Time)

Compare one time instance to another.

Declaration
public int CompareTo(Time other)
Parameters
Type Name Description
Time other

Structure to compare.

Returns
Type Description
System.Int32

1 if base time is greater, 0 if base time is equal to other and -1 if time is smaller than other.

| Improve this Doc View Source

Equals(Object)

Compare structure to other object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

Equals(Time)

Compare time to other time structure.

Declaration
public bool Equals(Time other)
Parameters
Type Name Description
Time other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Parse(DateTime)

Parse datetime and extract time.

Declaration
public static Time Parse(DateTime date)
Parameters
Type Name Description
System.DateTime date
Returns
Type Description
Time

Returns new instance of time.

| Improve this Doc View Source

Substract(TimePeriod)

Substract specific time period from time.

Declaration
public Time Substract(TimePeriod timePeriod)
Parameters
Type Name Description
TimePeriod timePeriod
Returns
Type Description
Time

Returns new time instance.

| Improve this Doc View Source

ToString()

Convert structure into string.

Declaration
public override string ToString()
Returns
Type Description
System.String

Returns formatted time HH:mm:ss.

Overrides
System.ValueType.ToString()

Operators

| Improve this Doc View Source

Addition(Time, Time)

Add time to time.

Declaration
public static Time operator +(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
Time

Returns new time instance. When sum exceeds 24:00:00 it returns maximum 24:00:00.

| Improve this Doc View Source

Equality(Time, Time)

Check if time1 is equal to time2.

Declaration
public static bool operator ==(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if both instances are equal.

| Improve this Doc View Source

GreaterThan(Time, Time)

Check if time1 is greater than time2.

Declaration
public static bool operator>(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if time1 is greater than time2.

| Improve this Doc View Source

GreaterThanOrEqual(Time, Time)

Check if time1 is is greater or equal to time2.

Declaration
public static bool operator >=(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if time1 is greater or equal to time2.

| Improve this Doc View Source

Inequality(Time, Time)

Check if time1 is not equal to time2.

Declaration
public static bool operator !=(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if both instances are not equal.

| Improve this Doc View Source

LessThan(Time, Time)

Check if time1 is smaller than time2.

Declaration
public static bool operator <(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if time1 is smaller than time2.

| Improve this Doc View Source

LessThanOrEqual(Time, Time)

Check if time1 is is smaller or equal to time2.

Declaration
public static bool operator <=(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
System.Boolean

True if time1 is smaller or equal to time2.

| Improve this Doc View Source

Subtraction(Time, Time)

Declaration
public static Time operator -(Time time1, Time time2)
Parameters
Type Name Description
Time time1
Time time2
Returns
Type Description
Time

Implements

System.IEquatable<T>
System.IComparable<T>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX