In my code, I\'m using DateTime objects to manipulate dates, then convert them to timestamp in order to save them in some JSON files.
DateTime
For some reasons,
since I resolved my issue i want to share it with You. Php71+ have microsecconds accuracy, if You want to convert it into nano accuracy just multiply it by 1000 (10^3).
$nsTimestamp = (int) (new \DateTime())->getTimestamp() * 1000