Jump to content

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
Link to post
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?

Link to post
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.

Link to post
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

Link to post
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.

Link to post
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

Link to post
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>

Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...