Change time constraints

Recommended Posts

this is a personal side project of mine, i am trying to change the time constraints of the hours, minutes, seconds, as well as change the start of the year to whatever I want it to be. ie days are 35 hours long, hours are 92 minutes long, minutes are 16 seconds long, and seconds are 200 milliseconds long, and the start of the year is February 29th is the beginning of the year in corralation to today's date, and have all of this done in the 24 hour time format where when the program first loads it works i would like to have this done in JavaScript, can someone help me??

Edited by Nedeku
Share on other sites

You would have to create your own new date object that took all that into account.

Share on other sites

question is, how....could you show me an example??

Share on other sites

Do you know object-oriented programming? And if you do, do you know how to implement it in Javascript?

Share on other sites

to both questions the answer is no

Share on other sites

Oh, well. It also can be done in other ways but it's not going to be well organized. To start off, I would take a base unit (milliseconds) and then put the relation between that and every other time unit:

`// Second is 200 millisecondsvar second = 200;// Minutes are 16 seconds, or 16*200 millisecondsvar minute = 3200;// Hours are 92 minutes long or 92 * 3200 millisecondsvar hour = 294400;// Days are 35 hours long or 35 * 294400 millisecondsvar day = 10304000;`

Now I've encountered a problem with your system: There's no relation between our real timescale and your timescale. If it's November 25th today and 365 days pass in your fictional time system it won't be November 25th in the real world, it would be some other date. Have you designed a solution for this problem?

Share on other sites

the only way i can see that the day correlation would be changed in that aspect would be to manually change each day to the desired specified day

Share on other sites

While I can program a system that counts a relative amount of time between a start and end point, I can't program a system that associates your timescale to real world dates because the systems aren't compatible. I can program a fictional "calendar" if you can tell me which exact date you consider to be the zero point in time. For the real date we have a UNIX timestamp that has a zero point in January 1st, 1970.

Share on other sites

well, those numbers that i mentioned before were example numbers.The time frames that i would be using isHours=1-20Minutes=1-40Seconds=1-80Milliseconds=1-1350the start date of the year is March 21, while the end date of the year is March 20, and while those days would coincide with today's date now since the time frame is maintained at 86,400 seconds, or 86,400,000 milliseconds, the only thing that would be truly changed is how many hours are in a day, how many minutes are in a hour, how many seconds are in a minute, and how many milliseconds are in a second

Share on other sites

It almost seems like the best way to do this would be to download a C compiler and check in the standard libraries for the time.h file, and go through that to look at their algorithms. The file should define constants for the various things you want to change. You could also check the sources files for Chromium or Firefox to see what's there.

Share on other sites

well, i found a way to make the program work in javascript, however, it shows as to how many Hours, Minutes, and Seconds since 1-1-1970, i however, now all i need to do is break that down to show the current time, not the difference between now and 1-1-1970

Share on other sites

<p> </p><div><!DOCTYPE html></div><div><html></div><div><head></div><div><script></div><div>function startTime()</div><div>{</div><div>var s=Math.floor(new Date()/1350);</div><div>var m=Math.floor(s/80);</div><div>var h=Math.floor(m/40);</div><div>var today=Math.floor(h/20);</div><div> </div><div>// add a zero in front of numbers<10</div><div>m=checkTime(m);</div><div>s=checkTime(s);</div><div>document.getElementById('txt').innerHTML=h+":"+m+":"+s;</div><div>t=setTimeout(function(){startTime()},500);</div><div>}</div><div> </div><div>function checkTime(i)</div><div>{</div><div>if (i<10)</div><div> {</div><div> i="0" + i;</div><div> }</div><div>return i;</div><div>}</div><div></script></div><div></head></div><div> </div><div><body onload="startTime()"></div><div><div id="txt"></div></div><div></body></div><div></html></div><div> </div>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.