Example #1
0
        internal static TimeMetricModel GetTimeZoneInfoForRequest(DateTime requestedDatetime)
        {
            var currentDateTime = DateTime.Now;
            var model           =
                new TimeMetricModel
            {
                Hour      = currentDateTime.TimeOfDay.Hours,
                DayOfWeek = (int)currentDateTime.DayOfWeek,
                Timezone  = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime()).TotalMinutes.ToString(CultureInfo.InvariantCulture)
            };

            model.Timestamp = model.GetUniqueMilliSecTimeStamp(requestedDatetime);
            return(model);
        }
Example #2
0
        internal static Dictionary <string, object> GetTimeMetricModel()
        {
            var currentDateTime = DateTime.Now;
            var model           = TimeMetricModel.GetTimeZoneInfoForRequest(currentDateTime);

            model.Timestamp = model.GetUniqueMilliSecTimeStamp();
            return(new Dictionary <string, object>
            {
                { "timestamp", model.Timestamp },
                { "hour", model.Hour },
                { "dow", model.DayOfWeek },
                { "tz", model.Timezone },
            });
        }