OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Time displays as minute (with decimal) : seconds instead of minutes:seconds

Open mudzbe opened this issue 2 years ago • 2 comments

image

Issue on paradise test on SS14

mudzbe avatar Dec 31 '23 03:12 mudzbe

This uses the following code:

/proc/add_zero(t, u)
	while(length(t) < u)
		t = "0[t]"
	return t

/// Take a value in seconds and makes it display like a clock (h:mm:ss)
/proc/seconds_to_full_clock(seconds as num)
	return "[round(seconds / 3600)]:[add_zero(num2text((seconds / 60) % 60), 2)]:[add_zero(num2text(seconds % 60), 2)]"

called here:

			var/timeleft = SSshuttle.emergency.timeLeft()
			if(SSshuttle.emergency.mode < SHUTTLE_DOCKED)
				dat += "ETA: <a href='?_src_=holder;edit_shuttle_time=1'>[seconds_to_full_clock(timeleft)]</a><br>"
				dat += "<a href='?_src_=holder;call_shuttle=2'>Send Back</a><br>"
			else
				dat += "ETA: <a href='?_src_=holder;edit_shuttle_time=1'>[seconds_to_full_clock(timeleft)]</a><br>"

Not sure what's going wrong with it.

ike709 avatar Dec 31 '23 04:12 ike709

the second_to_full_clock should be something like this

/proc/seconds_to_full_clock(seconds as num)
    return "[round(seconds / 3600)]:[add_zero(num2text(seconds / 60), 2)]:[add_zero(num2text(seconds % 60), 2)]" 

PraveenShinde3 avatar Dec 31 '23 05:12 PraveenShinde3

Fixed by #1759

ike709 avatar Apr 23 '24 03:04 ike709