DayZ 1.24
Loading...
Searching...
No Matches
TimeConversions.c
Go to the documentation of this file.
5{
6 int m_Days
7 int m_Hours
8 int m_Minutes
9 int m_Seconds
10
12 {
13 m_Hours += m_Days * 24;
14
15 string h;
16 string m;
17 string s;
18
19 if (m_Hours < 10)
20 h = "0";
21
22 if (m_Minutes < 10)
23 m = "0";
24
25 if (m_Seconds < 10)
26 s = "0";
27
28 return string.Format("%1%2:%3%4:%5%6", h, m_Hours, m, m_Minutes, s, m_Seconds);
29 }
30
32 {
33 return string.Format("%1#STR_time_unit_abbrev_day_0 %2#STR_time_unit_abbrev_hour_0 %3#STR_time_unit_abbrev_minute_0 %4#STR_time_unit_abbrev_second_0", m_Days, m_Hours, m_Minutes, m_Seconds);
34 }
35
37 {
38 string message;
39
40 if (m_Days > 0)
41 message += string.Format("%1#STR_time_unit_abbrev_day_0 ", m_Days);
42 if (m_Hours > 0)
43 message += string.Format("%1#STR_time_unit_abbrev_hour_0 ", m_Hours);
44 if (m_Minutes > 0)
45 message += string.Format("%1#STR_time_unit_abbrev_minute_0 ", m_Minutes);
46
47 message += string.Format("%1#STR_time_unit_abbrev_second_0", m_Seconds);
48
49 return message;
50 }
51}
52
54{
61 {
62 fullTime.m_Days = timeInSeconds / (24 * 3600);
63
64 timeInSeconds = timeInSeconds % (24 * 3600);
65 fullTime.m_Hours = timeInSeconds / 3600;
68 fullTime.m_Minutes = timeInSeconds / 60;
69
71 fullTime.m_Seconds = timeInSeconds;
72 }
73}
class FullTimeData ConvertSecondsToFullTime(int timeInSeconds, out FullTimeData fullTime)
transform time in seconds into FullTimeData struct
struct that keeps Time relevant information for future formatting
int m_Days int m_Hours int m_Minutes int m_Seconds string FormatedAsTimestamp()
string FormatedNonZero()
string FormatedWithZero()
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.