Table of Contents

Struct TimeStamp

Namespace
Virtufin.Base
Assembly
Virtufin.Base.dll

Calendar-date-backed ITimeStamp. Time-of-day is intentionally discarded; financial contracts settle on calendar dates.

public readonly record struct TimeStamp : ITimeStamp, IComparable<ITimeStamp>, IEquatable<ITimeStamp>, IEquatable<TimeStamp>
Implements
Inherited Members

Examples

var t = TimeStamp.New(2024, 6, 1);
Console.WriteLine(t);           // 2024-06-01
var later = t.AdvanceDays(7);   // 2024-06-08

Constructors

TimeStamp(DateOnly)

Calendar-date-backed ITimeStamp. Time-of-day is intentionally discarded; financial contracts settle on calendar dates.

public TimeStamp(DateOnly Value)

Parameters

Value DateOnly

Examples

var t = TimeStamp.New(2024, 6, 1);
Console.WriteLine(t);           // 2024-06-01
var later = t.AdvanceDays(7);   // 2024-06-08

Properties

Value

public DateOnly Value { get; init; }

Property Value

DateOnly

Methods

AdvanceDays(int)

Return a new TimeStamp advanced by days.

public TimeStamp AdvanceDays(int days)

Parameters

days int

Returns

TimeStamp

CompareTo(ITimeStamp?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(ITimeStamp? other)

Parameters

other ITimeStamp

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Equals(ITimeStamp?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ITimeStamp? other)

Parameters

other ITimeStamp

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

New(int, int, int)

Construct a TimeStamp from year/month/day.

public static TimeStamp New(int year, int month, int day)

Parameters

year int

Year component.

month int

Month component (1–12).

day int

Day component (1–31).

Returns

TimeStamp

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.