Hello everyone,
I am having following calculation line in my basic program.
B= Time in seconds eg: 3943
Int (B / 3600) -> H -(hour)
Int ((B-(H X 3600)) / 60) ->M (Minutes)
Int (B-((H X 3600)+(M X 60))) -> S (Seconds)
Now the time is 1 hour 5 minutes and 43 seconds
Suppose it is greater than 43.5000 seconds then I should print 44 Seconds
If it is less than 43.5000 seconds I should print 43 Seconds.
Anyone please help.
In my program am getting 40.735502 seconds I need to print it as 41 seconds.
Calculating And Printing Time
Started by
Naga
, Feb 06 2013 04:48 PM
3 replies to this topic
#1
Posted 06 February 2013 - 04:48 PM
#2
Posted 06 February 2013 - 05:00 PM
well, you could set rounding to
Fix 0
, but the best way would be to use LuaFX or C and access the RTC to make a timer.
#3
Posted 06 February 2013 - 06:12 PM
You can round like this
Int(S + .5)
.
Edited by Casimo, 06 February 2013 - 06:13 PM.
- Naga likes this
#4
Posted 06 February 2013 - 09:53 PM
thats probably better as there will be no decimal point if you do it that way.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users