I'm developing a Discord bot with Discord.js, and when I do the simple following code :
const onMessage = message => {
if (message.content === "&test") {
console.log(message.createdAt); // time attached to the message, stored by Discord
console.log(new Date()); // system time
}
// rest of the code
};
I get different results, as you can see :
2021-02-04T17:56:27.657Z
2021-02-04T17:55:46.094Z
As you can see, message.createdAt
is ahead of about 40 seconds.
I thought that the difference could come from my system time being not perfect, so I've checked Time.js and my system time is late of about 3 seconds. This means that the time I get from message.createdAt
is still 43 seconds ahead of the real time.
Does someone know what's the origin of this difference ?
EDIT : I've manually changed my system time, now I'm perfectly aligned with the real time, but I now have an offset of about 43 seconds between system time and createdAt.
EDIT : My problem is not about latency, everything responds fast, the problem is just about the time being significatively different.
question from:
https://stackoverflow.com/questions/66052144/difference-between-discord-js-message-createdat-time-and-system-time 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…