TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:24:26 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 171
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 172
  • Total: 173
  • tino

Countdown date/clock

Started by ICE, February 26, 2006, 01:52:31 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ICE

I've got a nice tool that counts down to a specific date and time (even ms).
I attached it to this topic.

Its very simple, though there is a small problem which I can't fix right now.

- Unzip the archive.
- Place the entire map clock in the Forum directory.
- Open the file demo.js in the map clock and change ALL inserted directories into yours. For example: I changed everything into:

Quote
http://formule1.justice4u.nl/ (following with clock/)

- Change the date (line 121)

There is probably the problem to find. Try it out yourself. You will see the script ads 1 month extra!!!

- Upload the entire map clock to the server.
- Make with TP a new SCRIPT block.
- Insert the next text into this block:

Quote
<script type="text/javascript"src="http://formule1.justice4u.nl/clock/demo.js"></script>

View the attached file to see what result this script gives.

I hope you guys can use it, but more I hope somebody can fix the problem!

[attachment deleted by admin]

crip

Just Don't use Theme_title / or Theme_frame.. uncheck all.

ICE


IchBin

Looks like we are all just a confused bunch here... lol

I don't quite get what you are saying ICE. I only see 1 month displayed.. I think Crip thought you were talking about the block header and title because you're arrow was pointing at it. Can you explain what you mean any better? sorry...

ICE

I will do my best ICHBIN!

I will use an example for this:
Say you want to scedule the first Grand Prix Formula 1 of this year on March, 12th at exactly 12.30.
If I took a look today, February, 26th at 21.30, the clock would give me:
0000 year, 1 month, 13 days, 15 hours, 00 minutes and 00 seconds.

That 1 month is not correct, because it is only 13 days left, dont you think? That is what I mean. So my guess is, I'm doing something wrong or the counter isnt counting like he should count !! ;)

Hope you understand me this time!

Bye the way, how do you like the script so far?

ICE

O, something important to tell:

I installed the script on my board at http://formule1.justice4u.nl , and it may seem that the clock is working, but I changed the setup-date in the script to: February, 12th !!!. That's why he's showing the correct number of days now !!! (Not 1 month) I know, it aint the correct way, but it's the only way for now !

Prime_8

#6
Fixed.. i for yaz
(old coder / debugger / testing powers!) O0

i don't know why but when i  added this line ( that logicaly should not be needed) it works fine.

bad code lived here (removed see next post

I don't know why this line is needed but was meant to be a debug test i put in to check to see if logic in rest of code was ok .. and it is .. and it works with this line added..  so done.

Prolly some dumbness in not being able to have month - month < 1

Prime_8

#7
ok nother small bug ..
(still wrong  LOL ?)
seems this is needed see arrow #2

if (x26 >= x16) s = x26 - x16;
else {s = 60+x26-x16; x15 = x15+1; }
if (x25 >= x15) min = x25 - x15;
else { min = 60+x25-x15; x14 = x14+1; }
if (x24 >= x14) h = x24 - x14;
else { h = 24+x24-x14; x13 = x13+1; }
if (x23 >= x13) d = x23-x13;
else { d = GetDayCount(x11,x12) + x23-x13; x22 = x22-1; }
if (x22 >= x12) m = x22-x12-1;         <----------------------#2----------- this line
else { m = 12+x22-x12; x11 = x11+1; }
if (x22 == x12) m = 0;                     <----------------------#1----------- this line
y = x21 - x11;



arrow #1 is only to make shure no devide by zeros happen but should be logicaly ok to remove line marked by arrow #1
arrow #2 shows the -1 added.  don't know why but works for me.
i wonder if  ther is a "=" where a "==" should be  ?? hmm

ICE

Trying to make sense out of this.

So, If I read this the right way, and I believe I do, I should remove line 1.
Thats all??

Prime_8

#9
hey  ice the error is deeper .. i tested a whole range of dates .. it has to do with how you are rounding the days down ..

see that fixes the month number but  ups the  days by the value of a month .. so the rror is in that code block or the get  number of days function...

I'm on sic leave for a number of months so i'll figure it out ..LOL