Fix converting timestamp to bytes.

The current conversion method was loosing milliseconds part.