DateTime represents an absolute instance in time.
Inheritance: FanObj
Exemple #1
0
 public static void make_(LogRec self, DateTime time, LogLevel level, string logName, string msg, Err err)
 {
     self.m_time    = time;
       self.m_level   = level;
       self.m_logName = logName;
       self.m_msg     = msg;
       self.m_err     = err;
 }
Exemple #2
0
 public override void modified(DateTime time)
 {
     throw IOErr.make("ZipEntryFile is readonly").val;
 }
Exemple #3
0
 public override void modified(DateTime time)
 {
     m_file.LastAccessTime = new System.DateTime(time.dotnet());
 }
Exemple #4
0
 //////////////////////////////////////////////////////////////////////////
 // Operators
 //////////////////////////////////////////////////////////////////////////
 public Duration minusDateTime(DateTime time)
 {
     return Duration.make(m_ticks-time.m_ticks);
 }
Exemple #5
0
        public static DateTime nowUtc(Duration tolerance)
        {
            long now = (System.DateTime.Now.Ticks - diffDotnet) * nsPerTick;

              DateTime c = cachedUtc;
              if (tolerance != null && now - c.m_ticks <= tolerance.m_ticks)
              return c;

              return cachedUtc = new DateTime(now, TimeZone.m_utc);
        }
Exemple #6
0
        static DateTime()
        {
            yearTicks[0] = -3155673600000000000L; // ns ticks for 1900
              firstWeekdayOfYear[0] = 1;
              for (int i=1; i<yearTicks.Length; ++i)
              {
            int daysInYear = 365;
            if (isLeapYear(i+1900-1)) daysInYear = 366;
            yearTicks[i] = yearTicks[i-1] + daysInYear*nsPerDay;
            firstWeekdayOfYear[i] = (byte)((firstWeekdayOfYear[i-1] + daysInYear) % 7);
              }

              for (int i=1; i<12; ++i)
              {
            dayOfYearForFirstOfMon[i] = dayOfYearForFirstOfMon[i-1] + daysInMon[i-1];
            dayOfYearForFirstOfMonLeap[i] = dayOfYearForFirstOfMonLeap[i-1] + daysInMonLeap[i-1];
              }

              fillInDayOfYear(monForDayOfYear, dayForDayOfYear, daysInMon);
              fillInDayOfYear(monForDayOfYearLeap, dayForDayOfYearLeap, daysInMonLeap);

              m_boot = now();
        }
Exemple #7
0
 public static void make_(LogRec self, DateTime time, LogLevel level, string logName, string msg)
 {
     make_(self, time, level, logName, msg, null);
 }
Exemple #8
0
 public static LogRec make(DateTime time, LogLevel level, string logName, string msg, Err err)
 {
     LogRec self = new LogRec();
       make_(self, time, level, logName, msg, err);
       return self;
 }
Exemple #9
0
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static LogRec make(DateTime time, LogLevel level, string logName, string msg)
 {
     return make(time, level, logName, msg, null);
 }
Exemple #10
0
 public OutStream writeNext(Uri path, DateTime modifyTime)
 {
     if (m_zipOut == null) throw UnsupportedErr.make("Zip not opened for writing").val;
       if (path.frag() != null) throw ArgErr.make("Path must not contain fragment: " + path).val;
       if (path.queryStr() != null) throw ArgErr.make("Path must not contain query: " + path).val;
       try
       {
     string zipPath = path.ToString();
     if (zipPath.StartsWith("/")) zipPath = zipPath.Substring(1);
     ZipEntry entry = new ZipEntry(zipPath);
     entry.DateTime = new System.DateTime(modifyTime.dotnet());
     m_zipOut.PutNextEntry(entry);
     return new ZipSysOutStream(m_zipOut);
       }
       catch (System.IO.IOException e)
       {
     throw IOErr.make(e).val;
       }
 }