![]() ![]() ![]() Now, you can probably guess the problem: The script counts up to 0.59 and then it sets to 1.0 and so on. Second fragment = (second_fragment < 10) ? "0"+second_fragment : second_fragment) If you're wondering wth this is it is because time % 60 sometimes returns 1-9, and they are not preceded by a zero, and I simply concatenate it below. So, What I have right now (only the logic, the language is weird and there is no tag for it on SO): full_seconds = ticks / 60 They are perfect for everyday activities such as cooking meals, taking quizzes, giving speeches, playing sports, or practicing music. Friend asked me to convert those ticks to seconds in a floating-point decimal format. Create your timers with optional alarms and start/pause/stop them simultaneously or sequentially. Another problems is that the language I am working with only supports integers (it is a deprecated language for an old scripting platform). I need to somehow convert these ticks into decimal seconds. I have a ticking mechanism which generates 60 ticks per 1 second(so, 120 ticks would be 2 seconds), which I didn't design (or have any control over), but I need to work with it. Finally, use FloorToInt to round each value down and string.Format to display them together correctly in a text field. Do this by dividing the float time by 60 to get the minutes and use the modulo operation (time 60) to get the seconds. I know there is a number of similar questions on Stackoverflow, but this one has a few unique requirements. To then display the float time value in minutes and seconds, both values need to be calculated individually.
0 Comments
Leave a Reply. |