DayZ
1.24
Loading...
Searching...
No Matches
TimeConversions.c
Go to the documentation of this file.
1
4
class
FullTimeData
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:5
FullTimeData::FormatedAsTimestamp
int m_Days int m_Hours int m_Minutes int m_Seconds string FormatedAsTimestamp()
Definition
TimeConversions.c:11
FullTimeData::FormatedNonZero
string FormatedNonZero()
Definition
TimeConversions.c:36
FullTimeData::FormatedWithZero
string FormatedWithZero()
Definition
TimeConversions.c:31
Param3
Definition
EntityAI.c:95
string::Format
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.
scripts
3_Game
tools
TimeConversions.c
Generated by
1.10.0