-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.cs
49 lines (44 loc) · 1.15 KB
/
Time.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lab4
{
internal class Time
{
private int hour;
private int minute;
private int second;
public Time()
{
hour = System.DateTime.Now.Hour;
minute = System.DateTime.Now.Minute;
second = System.DateTime.Now.Second;
}
public int Hour { get { return hour; } }
public int Minute { get { return minute; } }
public int Second { get { return second; } }
public Time(int hour, int minute, int second)
{
this.hour = hour;
this.minute = minute;
this.second = second;
}
public bool AddSecond(int _second)
{
this.second += _second;
if (second >= 60)
{
minute += second / 60;
second %= 60;
if (minute >= 60)
{
this.hour += minute / 60;
minute %= 60;
}
}
return true;
}
}
}