コード例 #1
0
        public void TestHelper()
        {
            //Create

            /*
             *
             * {"Channel":"f1351106ed1b6872d85bbf2eab0e93c9","Comment":"Created by Tv-Browser","Pri":2,"Start":1555594650,"Stop":1555604100,"SubTitle":{"Ger":"(2009)"},"Title":{"Ger":"Die Prinzessin von Montpensier"}}
             */

            Console.WriteLine("Orig:");
            Console.WriteLine(UnixTimeConverter.GetDateTimeFromUnixTime(1555587900));
            Console.WriteLine(UnixTimeConverter.GetDateTimeFromUnixTime(1555596000));

            Console.WriteLine("Auto:");
            Console.WriteLine(UnixTimeConverter.GetDateTimeFromUnixTime(1555587450));
            Console.WriteLine(UnixTimeConverter.GetDateTimeFromUnixTime(1555596900));



            var nowDateTime = DateTime.Now.TrimToSeconds();

            var unixTimestamp = UnixTimeConverter.GetUnixTimeFromDateTime(nowDateTime);

            var csharpDateTime = UnixTimeConverter.GetDateTimeFromUnixTime(unixTimestamp);

            Console.WriteLine($"{nowDateTime.Ticks} => {csharpDateTime.Ticks}");

            Assert.AreEqual(nowDateTime, csharpDateTime);
        }