Femtoseconds delay in c++

kaveh rahimi 61 Reputation points
2021-10-09T16:21:20.06+00:00

Hi , I am searching for a delay function that its duration is one femtosecond. How can I write my code?
Please explain completely by example.
Thanks

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,625 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Igor Tandetnik 1,106 Reputation points
    2021-10-09T18:46:39.01+00:00

    You can't. Consider: a typical modern CPU runs at about 3-4 GHz. This means a single machine instruction takes some 2*10^-10s to execute. You want something that's five orders of magnitude more precise (1 femtosecond = 10^-15 seconds). Your computer simply doesn't have any kind of clock running anywhere near this frequency. You'd need very specialized hardware to measure time with such precision.

    1 person found this answer helpful.
    0 comments No comments