A packet processing method, wherein the method is performed by a first network device, the first network device comprising a media conversion module and a service chip, wherein the media conversion module is an optical module and is configured to convert an incoming signal received from a second network device from an optical signal type into an electrical signal type and provide the incoming signal to the service chip and is further configured to convert an outgoing signal received from the service chip from the electrical signal type to the optical signal type and send the signal to the second network device, and wherein the service chip is configured to perform time stamping of incoming and outgoing packets, and wherein the method comprises: receiving (S110), from the second network device by using a first receiving interface of the media conversion module, a first packet, wherein the first packet comprises a first alignment marker, AM, wherein the first packet is included in a first data stream obtained by performing physical layer encoding on a first Ethernet frame stream and the first AM is periodically inserted after the physical layer encoding is performed on the first Ethernet frame stream; sending (S120), to the service chip by using a first sending interface of the media conversion module, a second packet, wherein the second packet comprises the first AM, and the second packet is the first packet processed by the media conversion module; calculating (S130), by the first network device, a receiving time delay T 1 between a time at which the media conversion module receives the first packet comprising the first AM and a time at which the media conversion module sends the second packet comprising the first AM; and receiving (S140), by using the first receiving interface of the media conversion module, a third packet and sending, by using the first sending interface of the media conversion module, the third packet after processing by the media conversion module, and determining (S150) a moment at which the first network device receives the third packet based on the receiving time delay T 1 and a first timestamp generated by the service chip when the third packet is received. receiving (S110), from the second network device by using a first receiving interface of the media conversion module, a first packet, wherein the first packet comprises a first alignment marker, AM, wherein the first packet is included in a first data stream obtained by performing physical layer encoding on a first Ethernet frame stream and the first AM is periodically inserted after the physical layer encoding is performed on the first Ethernet frame stream; sending (S120), to the service chip by using a first sending interface of the media conversion module, a second packet, wherein the second packet comprises the first AM, and the second packet is the first packet processed by the media conversion module; calculating (S130), by the first network device, a receiving time delay T 1 between a time at which the media conversion module receives the first packet comprising the first AM and a time at which the media conversion module sends the second packet comprising the first AM; and receiving (S140), by using the first receiving interface of the media conversion module, a third packet and sending, by using the first sending interface of the media conversion module, the third packet after processing by the media conversion module, and determining (S150) a moment at which the first network device receives the third packet based on the receiving time delay T 1 and a first timestamp generated by the service chip when the third packet is received. <EOS>