#region License Information /* HeuristicLab * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.DataImporter.Data { [StorableClass] public class DateTimeSpan : ICloneable { public DateTimeSpan() : base() { } [StorableConstructor] protected DateTimeSpan(bool deserializing) : base() { } [Storable] public int Seconds { get; set; } [Storable] public int Minutes { get; set; } [Storable] public int Hours { get; set; } [Storable] public int Days { get; set; } [Storable] public int Months { get; set; } [Storable] public int Years { get; set; } public static DateTime operator +(DateTime start, DateTimeSpan span) { DateTime ret = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second); ret = ret.AddSeconds(span.Seconds); ret = ret.AddMinutes(span.Minutes); ret = ret.AddHours(span.Hours); ret = ret.AddDays(span.Days); ret = ret.AddMonths(span.Months); ret = ret.AddYears(span.Years); return ret; } public object Clone() { DateTimeSpan obj = new DateTimeSpan(); obj.Seconds = this.Seconds; obj.Minutes = this.Minutes; obj.Hours = this.Hours; obj.Days = this.Days; obj.Months = this.Months; obj.Years = this.Years; return obj; } } }