python3 selfts = lambda introundtimetime 1000
This line of code creates a lambda function called ts that returns the current timestamp in milliseconds.
Here's how it works:
time.time()returns the current time in seconds since the epoch (January 1, 1970).round(time.time() * 1000)multiplies the current time by 1000 to convert it to milliseconds and rounds it to the nearest integer.int(round(time.time() * 1000))converts the result to an integer.
By assigning this lambda function to self.ts, you can use it to get the current timestamp in milliseconds whenever you need it
原文地址: https://www.cveoy.top/t/topic/isXJ 著作权归作者所有。请勿转载和采集!