Allow schema files that are missing checksums on the !!SCHEMAMATIC line.
[versaplex.git] / versaplexd / vxdbusdatetime.cs
blob76f3df1a8fd6c5fa7920de91ab6ec024e01cf935
1 /*
2 * Versaplex:
3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
5 */
6 using System;
8 public struct VxDbusDateTime {
9 public long seconds;
10 public int microseconds;
12 public DateTime DateTime {
13 get {
14 return new DateTime(seconds*10*1000*1000 + microseconds*10);
18 public VxDbusDateTime(DateTime dt)
20 long ticks = dt.Ticks + EpochOffset.Ticks;
21 seconds = ticks / 10 / 1000 / 1000;
22 microseconds = (int)((ticks / 10) % (1000*1000));
25 private static readonly DateTime Epoch = new DateTime(1970, 1, 1);
26 private static readonly TimeSpan EpochOffset = DateTime.MinValue - Epoch;