internal static int UtcToUnixTimeStamp(System_DateTime dt) { double seconds = (dt - UtcStartOfUnixEpoch).TotalSeconds; if (seconds < Int32.MinValue) return Int32.MinValue; if (seconds > Int32.MaxValue) return Int32.MaxValue; return (int)seconds; }
static int GetSwatchBeat(System_DateTime utc) { int seconds = DateTimeUtils.UtcToUnixTimeStamp(utc); int beat = (int)(((seconds - (seconds - ((seconds % 86400) + 3600))) * 10) / 864) % 1000; return((beat < 0) ? beat + 1000 : beat); }