| 12345678910111213141516171819202122232425262728 |
- namespace IndexFormula.Finance
- {
- using System;
- using System.ComponentModel;
- using System.Runtime.InteropServices;
- [StructLayout(LayoutKind.Sequential), TypeConverter(typeof(TimePeriodConverter))]
- public struct TimePeriod
- {
- public double Time1;
- public double Time2;
- public TimePeriod(double t1, double t2)
- {
- this.Time1 = t1 - ((int) t1);
- this.Time2 = t2 - ((int) t2);
- }
- public TimePeriod(DateTime t1, DateTime t2) : this(t1.ToOADate(), t2.ToOADate())
- {
- }
- public override string ToString()
- {
- return (DateTime.FromOADate(this.Time1).ToString("HH:mm") + " - " + DateTime.FromOADate(this.Time2).ToString("HH:mm"));
- }
- }
- }
|