In the current version of the OpenMI (1.4) we use our own interfaces to implement times. A few meetings ago the idea of using standard .NET times was introduced. However we could not convince Adrian that we should switch to standard .NET times. This page is created to discuss this issue and to write down all pros / cons.

Current approach (1.4)
  public interface ITime
  {
  }

  public interface ITimeSpan : ITime
  {
      ITimeStamp Start    { get;}
      ITimeStamp End      { get; }
  }

  public interface ITimeStamp : ITime
  {
      double ModifiedJulianDay { get; }
  }
		
  public interface ITimeSet
  {
      IList<ITime> Times { get; }
      TimeZoneInfo TimeZone { get; set; }
  }
Suggested approach using standard .NET types (2.0)
  interface ITime
  {
      DateTime TimeStamp { get; set; }
      TimeSpan Duration { get; set; }
  }	
  
  public interface ITimeSet
  {
      IList<ITime> Times { get; set; }
      TimeZoneInfo TimeZone { get; set; }
  }
  • DateTime and TimeSpan in the 2nd case are from standard .NET types. Similar types are available in Java. Actually TimeSpan is missing from current standard Java 6, so we would need to use something like a long to store the duration as milliseconds.
Suggested approach using standard Java types
  public interface ITime {
      public Date getTimeStamp();
      public long getDurationMillis();
  }	

  public interface ITimeSet {
      public TimeZone getTimeZone();
      public List<ITime> getTimes();
      public Date getTimeHorizon();
  }
  • No labels

1 Comment

  1. Unknown User (don)

    We also discussed a possibility to add bool hasDurations() to ITimeSet since not all time sets will work with durations. Then we can use it for ordinary time step times and time stamps with durations. Personally I would be also in favor of separate arrays for Times and Durations, then we won't need another interface like ITime. But in any case using standard date/time types step is something highly recommended.