The original code had delayed the timestamp and showed this offset:
Moving the timestamp to the beginning of the function reduced the offset: