I have written programs to set the time from an internal or external GPS and I used the SysTime DLL. It has separate SetDate and SetTime methods which is a bit naff. (Because time will progress whichever one you do first; best not to use either near midnight!)