Arduino Time.h - Resets on Serial Connection for Sync
In this case, I think you have to disable the reset-on-serial-connect function by modifying the board. Searching for 'arduino disable auto-reset' for how to do this to various arduino boards. It will be board specific but most involve adding a bleed resistor across the reset capacitor, removing a capacitor, or cutting a trace on the board.