Size is just plain wrong.  It should be message_size + timestamp_size +3.  Then again, you really don't need it; you can perfectly sensibly just use sprintf here, because you know you have exactly enough space.