public static DateTime DoShifting(DateTime time, TimeShift timeShift) { DateTime tempTime = time; tempTime = tempTime.AddYears(timeShift.Years).AddMonths(timeShift.Months).AddDays(timeShift.Days).AddHours(timeShift.Hours).AddMinutes(timeShift.Minutes).AddSeconds(timeShift.Seconds); return(tempTime); }
public async Task <List <DataPoint> > FetchData(bool applyTimeShift) { List <DataPoint> dataPoints; // Decide if we want display time shift TimeShift timeShift = null; if (applyTimeShift && DisplayTimeShift.IsTimeShiftZero() == false) { timeShift = DisplayTimeShift; } dataPoints = await Measurement.FetchDataAsync(null); // Handling timeshift here instead of the measurement to achieve modularity if (timeShift != null) { //todo complete this // find the shifting in double value double shiftForDateTime = timeShift.ToDoubleForDateTime(); for (int dataPntIter = 0; dataPntIter < dataPoints.Count; dataPntIter++) { double newX = dataPoints[dataPntIter].X + shiftForDateTime; dataPoints[dataPntIter] = new DataPoint(newX, dataPoints[dataPntIter].Y); } } return(dataPoints); }
public TimeShift Clone() { TimeShift timeShift = new TimeShift { Years = Years, Months = Months, Days = Days, Hours = Hours, Minutes = Minutes, Seconds = Seconds }; return(timeShift); }