We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D maze in browser controlled by Small Basic
#95
Hi, 
I have been testing the whole system on my localhost network and found a "suspicious" lines of code in the index.html. In details:

updatePlayer(element) {
      const now = new Date();
      const then = new Date(element.lastActive);

     const inactiveTime = (now - then) / 1000;
     ....
          if (inactiveTime < 60) { player ... }


1.  const now = new Date();
is CET time for me.

2. const then = new Date(element.lastActive);
is London Time which comes from Sqlite DB (also on my PC). 

Hence, the value:
const inactiveTime = (now - then) / 1000; 

is around 3600 (one hour). It means that player ... code is unreachable.

I tried an adhoc solution just for testing purposes which works well:

updatePlayer(element) {
     const nowLocal = new Date();

     const utcTime = nowLocal.getTime() + (nowLocal.getTimezoneOffset() * 60000);
     const londonTime = new Date(utcTime);

     const now = londonTime;
     const then = new Date(element.lastActive);
...


Also, Tag option is chosen in settings.html.
Reply


Messages In This Thread
RE: 3D maze in browser controlled by Small Basic - by stevantosic - 02-24-2025, 02:15 PM

Forum Jump:


Users browsing this thread: 41 Guest(s)