MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / secDiffToDate

Method secDiffToDate

src/main/java/ui/Time.java:197–232  ·  view source on GitHub ↗
(int seconds)

Source from the content-addressed store, hash-verified

195 }
196
197 public static String secDiffToDate(int seconds){
198 String result ="";
199 int d = 0,h = 0,m = 0,s = 0;
200 if (seconds>86400){
201 d=(seconds/86400);
202 seconds=seconds-(d*86400);
203 }
204 if (seconds>3600){
205 h=(seconds/3600);
206 seconds=seconds-(h*3600);
207 }
208 if (seconds>60){
209 m=(seconds/60);
210 seconds=seconds-(m*60);
211 }
212 s=seconds;
213
214 if (d>0) {
215 result+= d + " " + goodWordForm (d,3);
216 }
217 if (h>0) {
218 if (d>0) result+=", ";
219 result+= h + " " + goodWordForm (h, 2);
220 }
221 if (m>0) {
222 if ((d>0) || (h>0)) result+=", ";
223 result+= m + " " + goodWordForm (m, 1);
224 }
225 if (s>0) {
226 if ((d>0) || (h>0) || (m>0)) result+=", ";
227 result+= s + " " + goodWordForm (s, 0);
228 }
229 if (result.equals("") && s==0)
230 result=s + " " + goodWordForm (s, 0);
231 return result;
232 }
233
234 public static String goodWordForm (int d, int field) {
235 String [][] suf = {

Callers 1

dispatchLastMethod · 0.95

Calls 2

goodWordFormMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected