Esempio n. 1
0
        public static Dynastream.Fit.DateTime ToLocalDateTime(Dynastream.Fit.DateTime dt)
        {
            DateTime dateTime  = dt.GetDateTime();
            DateTime lDateTime = dateTime.ToLocalTime();

            return(new Dynastream.Fit.DateTime(lDateTime));
        }
Esempio n. 2
0
        public static DateTime ToLocalDateTime(uint timeStamp)
        {
            Dynastream.Fit.DateTime dt = new Dynastream.Fit.DateTime(timeStamp);
            DateTime dt1 = dt.GetDateTime();

            return(dt1.ToLocalTime());
        }
Esempio n. 3
0
        /// <summary>
        /// constructor
        /// </summary>
        public TcxLap(string dateTimeString)
        {
            // init list of tracks
            this.tracks = new List <TcxTrack>();

            // init fields
            this.startTime = TcxUtility.ToFitTime(dateTimeString);
            this.timestamp = this.startTime.GetTimeStamp();
        }
Esempio n. 4
0
        public void ToFitTime_Test_Pass()
        {
            string      dateTimeString = "2017-11-27T12:16:30.000Z";
            SysDateTime actual         = new SysDateTime(2017, 11, 27, 12, 16, 30, DateTimeKind.Utc);

            DateTime dateTime = TcxUtility.ToFitTime(dateTimeString);

            Assert.AreEqual(dateTime.GetDateTime(), actual);
        }
Esempio n. 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dateTimeString"></param>
        public TcxActivity(string dateTimeString)
        {
            // create new List of laps
            this.laps = new List <TcxLap>();

            // init fields
            this.id             = TcxUtility.ToFitTime(dateTimeString);
            this.timestamp      = TcxUtility.ToFitTime(dateTimeString).GetTimeStamp();
            this.LocalTimestamp = this.Timestamp;
        }
Esempio n. 6
0
        public void ToFitTime_Test_FailDueToConvertException()
        {
            string   dateTimeString = "";
            DateTime dateTime       = null;

            try {
                dateTime = TcxUtility.ToFitTime(dateTimeString);
            } catch {
                Assert.Fail();
                Assert.AreEqual(dateTime, null);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Convert string to time
        /// </summary>
        /// <param name="dateTimeString">will be in a format of yyyy-mm-ddThh:mm:ss.000z</param>
        /// <returns></returns>
        public static DateTime ToFitTime(string dateTimeString)
        {
            //dateTimeString = dateTimeString.Replace("000Z", "0000000Z");
            try
            {
                // format can be "o"
                SysDateTime sysDateTime = SysDateTime.ParseExact(dateTimeString, "yyyy-MM-dd'T'HH:mm:ss.fff'Z'", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
                DateTime    dateTime    = new DateTime(sysDateTime);
                return(dateTime);
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} is not in the correct format.", dateTimeString);
                Console.WriteLine(e.Message);
            }

            return(null);
        }
Esempio n. 8
0
 public DateTime(Dynastream.Fit.DateTime dateTime)
     : this(dateTime.GetTimeStamp(), dateTime.GetFractionalTimeStamp())
 {
 }