Example #1
0
File: DateTime.cs Project: xored/f4
 internal static DateTime makeDT(Date d, Time t, TimeZone tz)
 {
     return new DateTime(d.m_year, d.m_month, d.m_day, t.m_hour, t.m_min, t.m_sec, t.m_ns, System.Int32.MaxValue, tz);
 }
Example #2
0
File: DateTime.cs Project: xored/f4
 //////////////////////////////////////////////////////////////////////////
 // Constructor - Date, Time
 //////////////////////////////////////////////////////////////////////////
 internal static DateTime makeDT(Date d, Time t)
 {
     return makeDT(d, t, TimeZone.m_cur);
 }
Example #3
0
File: Time.cs Project: nomit007/f4
 public DateTime toDateTime(Date d, TimeZone tz)
 {
     return DateTime.makeDT(d, this, tz);
 }
Example #4
0
File: Date.cs Project: nomit007/f4
        public Duration minusDate(Date that)
        {
            // short circuit if equal
              if (this.Equals(that)) return Duration.Zero;

              // compute so that a < b
              Date a = this;
              Date b = that;
              if (a.compare(b) > 0) { b = this; a = that; }

              // compute difference in days
              long days = 0;
              if (a.m_year == b.m_year)
              {
            days = b.dayOfYear() - a.dayOfYear();
              }
              else
              {
            days = (DateTime.isLeapYear(a.m_year) ? 366 : 365) - a.dayOfYear();
            days += b.dayOfYear();
            for (int i=a.m_year+1; i<b.m_year; ++i)
              days += DateTime.isLeapYear(i) ? 366 : 365;
              }

              // negate if necessary if a was this
              if (a == this) days = -days;

              // map days into ns ticks
              return Duration.make(days * Duration.nsPerDay);
        }
Example #5
0
File: Time.cs Project: nomit007/f4
 public DateTime toDateTime(Date d)
 {
     return DateTime.makeDT(d, this);
 }