Artificial intelligent assistant

Formula to convert time to pixels I have a list of times represented as `000000` to `240000`. For a web application, I convert those times to pixels by simply dividing by 100, so that their display position is ordered from the top of the page. In other words, the time `160000` becomes `1600px`. This works fine for times which are "on the hour", but obviously, there is a problem when the time is more complex. For example, `163000` becomes `1630px` when, in order to display proportionally, it should be `1650px`. How can I achieve this mathematically?

Given a "time" of the form: `t = HHMMSS`, we want to convert it to a four digit number of pixels representing $100$ times the number of hours that have elapsed since midnight. Using Python $3.3$ together with the flooring and modulo operations, we can achieve this goal by doing something like this:


def time2pixels(t):
seconds = t % 100 # Get the last two digits.

minutes = int(t / 100) % 100 # Get the middle two digits.
minutes += seconds / 60.0 # Convert the seconds to minutes and add it on.

hours = int(t / 10000) # Get the first two digits.
hours += minutes / 60.0 # Convert the minutes to hours and add it on.

return int(hours * 100) # Convert from hours to pixels.

print(time2pixels(163000)) # Outputs: 1650

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2842ea4df6f7d23d4c12e3fa69606eb1