Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
timeconversions.c
Go to the documentation of this file.
1 
5 {
6  int m_Days
7  int m_Hours
8  int m_Minutes
9  int m_Seconds
10 
11  string FormatedAsTimestamp()
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 
31  string FormatedWithZero()
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 
36  string FormatedNonZero()
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 
53 class TimeConversions
54 {
60  static void ConvertSecondsToFullTime(int timeInSeconds, out FullTimeData fullTime)
61  {
62  fullTime.m_Days = timeInSeconds / (24 * 3600);
63 
64  timeInSeconds = timeInSeconds % (24 * 3600);
65  fullTime.m_Hours = timeInSeconds / 3600;
66 
67  timeInSeconds = timeInSeconds % 3600;
68  fullTime.m_Minutes = timeInSeconds / 60;
69 
70  timeInSeconds = timeInSeconds % 60;
71  fullTime.m_Seconds = timeInSeconds;
72  }
73 }
ConvertSecondsToFullTime
class FullTimeData ConvertSecondsToFullTime(int timeInSeconds, out FullTimeData fullTime)
transform time in seconds into FullTimeData struct
Definition: timeconversions.c:60
FullTimeData
struct that keeps Time relevant information for future formatting
Definition: timeconversions.c:4