9#define count_years_decs(time, decs) sprintf(CTX(_("CI_DEC^%s years")), ftos_decimals(time, decs))
10#define count_years(time) \
12 _("CI_ZER^%d years"), \
13 _("CI_FIR^%d year"), \
14 _("CI_SEC^%d years"), \
15 _("CI_THI^%d years"), \
18#define count_weeks_decs(time, decs) sprintf(CTX(_("CI_DEC^%s weeks")), ftos_decimals(time, decs))
19#define count_weeks(time) \
21 _("CI_ZER^%d weeks"), \
22 _("CI_FIR^%d week"), \
23 _("CI_SEC^%d weeks"), \
24 _("CI_THI^%d weeks"), \
27#define count_days_decs(time, decs) sprintf(CTX(_("CI_DEC^%s days")), ftos_decimals(time, decs))
28#define count_days(time) \
30 _("CI_ZER^%d days"), \
32 _("CI_SEC^%d days"), \
33 _("CI_THI^%d days"), \
36#define count_hours_decs(time, decs) sprintf(CTX(_("CI_DEC^%s hours")), ftos_decimals(time, decs))
37#define count_hours(time) \
39 _("CI_ZER^%d hours"), \
40 _("CI_FIR^%d hour"), \
41 _("CI_SEC^%d hours"), \
42 _("CI_THI^%d hours"), \
46#define count_minutes_decs(time, decs) sprintf(CTX(_("CI_DEC^%s minutes")), ftos_decimals(time, decs))
47#define count_minutes(time) \
49 _("CI_ZER^%d minutes"), \
50 _("CI_FIR^%d minute"), \
51 _("CI_SEC^%d minutes"), \
52 _("CI_THI^%d minutes"), \
53 _("CI_MUL^%d minutes"))
55#define count_seconds_decs(time, decs) sprintf(CTX(_("CI_DEC^%s seconds")), ftos_decimals(time, decs))
56#define count_seconds(time) \
58 _("CI_ZER^%d seconds"), \
59 _("CI_FIR^%d second"), \
60 _("CI_SEC^%d seconds"), \
61 _("CI_THI^%d seconds"), \
62 _("CI_MUL^%d seconds"))
72 int last2digits = interval % 100;
75 if (last2digits < 4 || last2digits > 20)
76 switch (last2digits % 10)
78 case 1:
return sprintf(_(
"%dst"), interval);
79 case 2:
return sprintf(_(
"%dnd"), interval);
80 case 3:
return sprintf(_(
"%drd"), interval);
83 return sprintf(_(
"%dth"), interval);
87string count_fill(
float interval,
string zeroth,
string first,
string second,
string third,
string multi)
101 switch (
floor(interval))
103 case 0:
return sprintf(
CTX(zeroth), interval);
106 return sprintf(
CTX(first), interval);
108 return sprintf(
CTX(multi), interval);
109 case 2:
return sprintf(
CTX(second), interval);
110 case 3:
return sprintf(
CTX(third), interval);
111 default:
return sprintf(
CTX(multi), interval);
119 int tmp_hours = 0, tmp_minutes = 0, tmp_seconds;
120 int tmp_years = 0, tmp_weeks = 0, tmp_days = 0;
122 tmp_seconds =
floor(seconds);
126 tmp_minutes =
floor(tmp_seconds / 60);
130 tmp_seconds -= tmp_minutes * 60;
131 tmp_hours =
floor(tmp_minutes / 60);
135 tmp_minutes -= tmp_hours * 60;
136 tmp_days =
floor(tmp_hours / 24);
140 tmp_hours -= tmp_days * 24;
141 tmp_weeks =
floor(tmp_days / 7);
145 tmp_days -= tmp_weeks * 7;
146 tmp_years =
floor(tmp_weeks / 52);
155 case 1:
return sprintf(
"%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds);
159 #define APPEND_TIME(unit) \
161 output = strcat(output, ((output != "") ? ", " : ""), count_##unit(tmp_##unit))
178 tmp_days += (tmp_weeks * 7);
180 tmp_days += (tmp_years * 365);
184 ((output !=
"") ?
strcat(
", ", output) :
"")
#define APPEND_TIME(unit)
#define count_hours(time)
ERASEABLE string count_ordinal(int interval)
ERASEABLE string count_fill(float interval, string zeroth, string first, string second, string third, string multi)
#define count_seconds(time)
ERASEABLE string process_time(float outputtype, int seconds)
ERASEABLE string CTX(string s)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))