I'm starting to provide Chinese / English versions of some posts, switch with the Language menu above. 我开始提供部分文章的中文、英文翻译,请使用顶部语言菜单切换。

A Javascript for time crowdfunding calculation

In the old Eastern country with mysterious magic power, a minute will pass every 59 seconds.

var toad = new Date();
var secondsDonated = Math.floor((toad.getTime() + 1368835200000) / 59000);
toad.setTime(toad.getTime() + secondsDonated * 1000);

-1368835200 is the UNIX timestamp of his birthday, and the trailing zeroes are added because time is calculated in milliseconds in Javascript.

By donating your time, you are identical to a person living in outside China.

You and each person has donated seconds. That is years, days, hours, minutes and seconds.

« 上一篇文章

本站使用运行在 Vercel 上的 Waline 评论系统,中国大陆访问可能不稳定。