示例#1
0
文件: DateTime.cs 项目: 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);
 }
示例#2
0
文件: DateTime.cs 项目: xored/f4
 //////////////////////////////////////////////////////////////////////////
 // Constructor - Date, Time
 //////////////////////////////////////////////////////////////////////////
 internal static DateTime makeDT(Date d, Time t)
 {
     return makeDT(d, t, TimeZone.m_cur);
 }
示例#3
0
文件: Time.cs 项目: nomit007/f4
 public DateTime toDateTime(Date d, TimeZone tz)
 {
     return DateTime.makeDT(d, this, tz);
 }
示例#4
0
文件: Date.cs 项目: 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);
        }
示例#5
0
文件: Time.cs 项目: nomit007/f4
 public DateTime toDateTime(Date d)
 {
     return DateTime.makeDT(d, this);
 }