A displacement sensor for detecting displacement using a phase difference between an input signal waveform and an output signal waveform, in order to output, in response to a request from a servo system for generating an instruction to eliminate error between the current position and the target position by comparing a current position and a target position every control period, the current position to the servo system, comprising: a counter counting clock signals from a clock circuit, wherein the counter resets the count value in response to a reset signal from an AC power supply of the displacement sensor and is latched at a point in time when the input signal waveform is zero; a timer for outputting a detection time when the counter is latched due to the sensor detecting a displacement; a storage for storing at least two previous detected displacements together with detection times thereof; and an operation unit for extrapolating, when output is requested from the servo system, the at least two previous displacements to a current displacement, based on the at least two previous displacements and detection times and a time at which output was requested, and outputting the current displacement, the storage further storing (D i -D i-1)/(t i -t i-1), and the operation unit being configured to derive a displacement at time r+τ as a current displacement D r by D r = D i + r + τ - t i x D i - D i - 1 / t i - t i - 1 using the value of (D i -D i-1)/(t i -t i-1) stored in the storage, and output the current displacement D r to the servo system as the current position, where Di and D i-1 are the two previous displacements, ti and t i-1 are the two previous detection times, r is the time at which output was requested, Dr is the current displacement, and τ is an operation delay in the operation unit. a counter counting clock signals from a clock circuit, wherein the counter resets the count value in response to a reset signal from an AC power supply of the displacement sensor and is latched at a point in time when the input signal waveform is zero; a timer for outputting a detection time when the counter is latched due to the sensor detecting a displacement; a storage for storing at least two previous detected displacements together with detection times thereof; and an operation unit for extrapolating, when output is requested from the servo system, the at least two previous displacements to a current displacement, based on the at least two previous displacements and detection times and a time at which output was requested, and outputting the current displacement, the storage further storing (D i -D i-1)/(t i -t i-1), and the operation unit being configured to derive a displacement at time r+τ as a current displacement D r by D r = D i + r + τ - t i x D i - D i - 1 / t i - t i - 1 using the value of (D i -D i-1)/(t i -t i-1) stored in the storage, and output the current displacement D r to the servo system as the current position, where Di and D i-1 are the two previous displacements, ti and t i-1 are the two previous detection times, r is the time at which output was requested, Dr is the current displacement, and τ is an operation delay in the operation unit.