With the development of digital substation, the devices of the substation put forward higher demands on clock synchronization. The standard of the IEEE1588 provides a protocol that enables precise synchronization of clocks in measurement and control systems, and the precision of its network is sub-microsecond level which can satisfy the need of clock synchronization of the substation. This paper makes a brief analysis of the principles of clock synchronization and the protocol state machine, and achieves the clock synchronization by programming. Under the Linux operating system, the design of software contains the protocol engine module, transmission control module and receipt control module. Eventually it is transplanted into the platform of ARM9 and tested. The results show that the precision of time synchronization this paper designed can meet the requirements of the synchronous units of digital substation.