In a substation automation system(SAS), it is vital for stability and fault analysis of the electric power system with time synchronization at lower operating cost. An optimized algorithm of network time protocol(NTP) is put forward and then implemented in the SAS. It simplifies the structure of the hardware system and satisfies the requirement of the time accuracy of the control layer in a sheer software way.