Subversion Repositories SmartDukaan

Rev

Rev 34723 | Rev 34769 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34723 Rev 34761
Line 47... Line 47...
47
 
47
 
48
	public static final LocalTime toTime(String timeString) throws DateTimeParseException{
48
	public static final LocalTime toTime(String timeString) throws DateTimeParseException{
49
		return LocalTime.parse(timeString);
49
		return LocalTime.parse(timeString);
50
	}
50
	}
51
 
51
 
52
	public static final LocalTime secondsToTime(long totalSeconds) throws DateTimeParseException{
52
	public static final LocalTime secondsToTime(double totalSeconds) throws DateTimeParseException{
-
 
53
		int totalSecs = (int) Math.round(totalSeconds);
53
		int hours = (int) totalSeconds / 3600;
54
		int hours = totalSecs / 3600;
54
		int minutes = (int) (totalSeconds % 3600) / 60;
55
		int minutes = (totalSecs % 3600) / 60;
55
		int seconds = (int) totalSeconds % 60;
56
		int seconds = totalSecs % 60;
56
		String timeString = String.format("%02d:%02d:%02d", hours, minutes, seconds);
57
		String timeString = String.format("%02d:%02d:%02d", hours, minutes, seconds);
57
		return LocalTime.parse(timeString);
58
		return LocalTime.parse(timeString);
58
	}
59
	}
59
 
60
 
60
	public static final LocalTime timeDifference(LocalTime startTime, LocalTime endTime) throws DateTimeParseException{
61
	public static final LocalTime timeDifference(LocalTime startTime, LocalTime endTime) throws DateTimeParseException{
Line 231... Line 232...
231
		int minute = Integer.parseInt(oxigenRechargeRequestDate.substring(10, 11));
232
		int minute = Integer.parseInt(oxigenRechargeRequestDate.substring(10, 11));
232
		int second = Integer.parseInt(oxigenRechargeRequestDate.substring(12, 13));
233
		int second = Integer.parseInt(oxigenRechargeRequestDate.substring(12, 13));
233
		return LocalDateTime.of(year, month, dayOfMonth, hour, minute, second);
234
		return LocalDateTime.of(year, month, dayOfMonth, hour, minute, second);
234
	}
235
	}
235
 
236
 
-
 
237
	public static String formatDistance(double distanceInMeters) {
-
 
238
		if (distanceInMeters >= 1000) {
-
 
239
			return String.format("%.2f km", distanceInMeters / 1000.0);
-
 
240
		} else if (distanceInMeters >= 1) {
-
 
241
			return String.format("%.0f m", distanceInMeters);
-
 
242
		} else {
-
 
243
			return String.format("%.0f cm", distanceInMeters * 100);
-
 
244
		}
-
 
245
	}
-
 
246
 
236
}
247
}