Difference between revisions of "Talk:Input number of seconds, get a string back that shows days, hours, minutes, seconds"

From Second Life Wiki
Jump to navigation Jump to search
(Comment on redundant llFloor())
(No difference)

Revision as of 02:36, 24 December 2012

Redundant use of llFloor()

The use of llFloor() is bizarre in this script, e.g. days=llFloor(secs/86400);

As secs was declared as an integer, secs/86400 is executed as an integer division, which inherently drops any fractional part of the result.

By then using that integer result as an argument of llFloor(), the compiler has to convert the integer to a float (which will simply add .0)

and the llFloor() function has nothing to do (no fraction to remove) so it just converts back to an integer to provide the result.

In other words, your use of llFloor() is redundant throughout this example. Just do the integer division.

Omei Qunhua 01:36, 24 December 2012 (PST)