LongPress/ShortPress button two functions

firsttime is a flag.
When it is set i.e. 1, you lock in the start time which subsequently is used in the calculations.

Suggest you use a name like firstTimeFlag.

BTW
Use CTRL T to format the sketch.
Please use code tags.
Use the </> icon in the posting menu.

[code] Paste sketch here. [/code]

I am sure if you think about it a bit, you can figure out how to control printing the way you need.

.