Add logic for the LOCAL timestamp.

Also add more comments.