1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
24 | using HEAL.Attic;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.DataImporter.Data {
|
---|
27 | [StorableType("4FCE3999-08A9-41A0-96D8-653F6B84B141")]
|
---|
28 | public class DateTimeSpan : ICloneable {
|
---|
29 | public DateTimeSpan() : base() { }
|
---|
30 | [StorableConstructor]
|
---|
31 | protected DateTimeSpan(StorableConstructorFlag _) { }
|
---|
32 |
|
---|
33 | [Storable]
|
---|
34 | public int Seconds { get; set; }
|
---|
35 | [Storable]
|
---|
36 | public int Minutes { get; set; }
|
---|
37 | [Storable]
|
---|
38 | public int Hours { get; set; }
|
---|
39 | [Storable]
|
---|
40 | public int Days { get; set; }
|
---|
41 | [Storable]
|
---|
42 | public int Months { get; set; }
|
---|
43 | [Storable]
|
---|
44 | public int Years { get; set; }
|
---|
45 |
|
---|
46 | public static DateTime operator +(DateTime start, DateTimeSpan span) {
|
---|
47 | DateTime ret = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second);
|
---|
48 | ret = ret.AddSeconds(span.Seconds);
|
---|
49 | ret = ret.AddMinutes(span.Minutes);
|
---|
50 | ret = ret.AddHours(span.Hours);
|
---|
51 | ret = ret.AddDays(span.Days);
|
---|
52 | ret = ret.AddMonths(span.Months);
|
---|
53 | ret = ret.AddYears(span.Years);
|
---|
54 | return ret;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public object Clone() {
|
---|
58 | DateTimeSpan obj = new DateTimeSpan();
|
---|
59 | obj.Seconds = this.Seconds;
|
---|
60 | obj.Minutes = this.Minutes;
|
---|
61 | obj.Hours = this.Hours;
|
---|
62 | obj.Days = this.Days;
|
---|
63 | obj.Months = this.Months;
|
---|
64 | obj.Years = this.Years;
|
---|
65 | return obj;
|
---|
66 | }
|
---|
67 | }
|
---|
68 | }
|
---|