News:

Wondering if this will always be free?  See why free is better.

Main Menu

CountDown BBC

Started by .HuNTeR., December 25, 2008, 04:03:26 AM

Previous topic - Next topic

.HuNTeR.

@ke4obt
goto Themes\default\languages
and change
$txt['cd_remaning'] = ' remaning.';
to
$txt['cd_remaning'] = '';

@KadirX
maybe in next version ;)

tmdg

Hi,
I just tried out this Mod and found it was out by several hours.  So looking at the code I found the reason. 

The code calculates a month as 2629743.83 seconds.  But months aren't that long.  Months vary  2419200 == 28 days, 2505600 == 29days and so on.

As an example. I use a target  time of 02,25,2009,15,00.

At 08:53 on 25 Jan 2009 the result is :-
1 month 19 hours 37 minutes remaning.

It should of course be 1 month 6 hours 7 minutes remaining

To be precise its 31 days 6 hours and 7 minutes.
Or 4 weeks 3 days 6 hours and 7 minutes.

I note also that you use 31556926 seconds per year when in fact there are only 3153600 seconds per year or 31622400 if it's a leap year.

Note also you have spelt remaining incorrectly.


Regards,
Tom.

tmdg

#22
I just made a quick change to calculate weeks rather than months and
corrected the seconds per year so the times are correct until you get past 28 Feb 2012.  IMVHO it is much cleaner.

All did was change the following in Subs.php
31556926 to  31536000
2629743.83  to  604800
$month to $week
cd_month to cd_week
cd_months to cd_weeks


added the following two lines to Modifications.english.php
$txt['cd_week'] = ' week';
$txt['cd_weeks'] = ' weeks';


.HuNTeR.

@tom you are completely right but actually i just use Google for average seconds for year and month
http://www.google.com/search?hl=en&q=year+to+second&btnG=Google+Search&aq=f&oq=
http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=mBj&q=month+to+second&btnG=Search

and as you can see this mod hasn't too many downloads
but some day i will fix this issues and also will use JavaScript to real time countdown
thanks for your info sharing

tmdg

Hi

I've now given the script a pretty good hack attack.  I think I have a good handle on the problem.

With my hack the script now shows

At :- 25 January 2009, 17:35:46 with a target time of 15:00 on each day.
Quote


25th Feb 2012  3 years 4 weeks 2 days 21 hours 24 minutes remaining.
27th Feb 2012  3 years 1 month 1 day 21 hours 24 minutes remaining.
28th Feb 2012  3 years 1 month 2 days 21 hours 24 minutes remaining.
29th Feb 2012  3 years 1 month 3 days 21 hours 24 minutes remaining.
1st Mar 2012  3 years 1 month 4 days 21 hours 24 minutes remaining.

Now the output looks a little odd if that the 25 is 4 weeks 2 days where as the 27 is 1 month 1 day.

Since people think of a month == 4 weeks one may say the script is wrong.  However,  looking at it more closely.  25th Feb is 31 days after 25th Jan.  In Jan the month is 31 days.  but we are past the 15:00 target time so it is less than the 31 day month thence it's 4 weeks.


If your interested in the code I have written your quite welcome to have it.

IMVHO I think the script should also have a "Timezone" argument.  The sever the script is run on may not be the same Timezone as the event you are attempting to count down to.

Regards,
Tom.

[unplugged]

I am interested in it.  :P
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



.HuNTeR.

hi tom
go ahead and share your code with us
this is what people in open source projects do
thanks a lot ;)

tmdg

Hi,

I'm just putting the final touches to the installable script and then I'll post the mod.

Tom.

tmdg

#28
Hi,

Attached below is the updated code. I'm not sure how one goes about creating an update so I called the file something different.  I think you need to uninstall the original and then install this version.   I've not read all of the documentation about the coding standards so I may well have broken something there.


I'll look at how you write an update and change the package later.

regards,
Tom.

Note: -  I have removed the update see my post below for a newer version.

ke4obt

Tom,
there is one wee, little problem - the edit to modifications.english.php are going AFTER the closing ?> tag. It should go BEFORE.
I fixed that manually and it works beautifully! Before I fixed it, though, had a page FULL of errors.
Have you figured out how to put a timezone offset into it? Our server is set to mountain time USA (no DST for the server), and our site is set to GMT. So, I have to remember to set it 7 hours different.

Thanks,
Flip
Thanks Much

Flip - KE4OBT
     The Blind Ham
Helping other blind hams
get on the air!


Yes I am really a BLIND user!

So, if a mod doesn't install properly, and I can't get help from your part of the forum,
I will come begging for YOUR help since you wrote it and know how it works
um, uh, well,
At least I would really, really hope you do!
HEE-HEE-HEE

[unplugged]

I just double-checked my Modifications.english.php and the edits seem to be in the correct place (before the ?>).
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



ke4obt

odd. I just downloaded, uploaded and installed it (no problems with the install, BTW). Went to check it, got a page full of errors which my wife figured out where they were coming from. Checked the modifications.english.php file and the edits for countdown bbc were after the ?>   Oh well, it works. :)
So, maybe you all can help me with another little thing. I would like to add another clock to the header/top of the forum (where the forum clock already is) that says "Forum Time". Then put a tag on the  "default" clock that says "Your Time". Also, put a permission on it so that the "your time" clock doesn't show up unless you're logged in. (not sure if that would really be a permission, but whatever - tag, hidden permission).
I'm just not sure how to go about getting that done. I had put a post up and somebody sent me to the php.net site which totally messed with my mind for about 4 days or so. My poor wife had to smack me in the head to reboot my brain. :D   (my brain must have Windows for an OS).
Any help, suggestions or just a good shove in the right direction would be greatly appreciated.
Just as a reminder, since I use a screen reader - it doesn't read ALL characters unless I do it manually by using the cursor keys to go one letter/character at a time.
Thanks Much

Flip - KE4OBT
     The Blind Ham
Helping other blind hams
get on the air!


Yes I am really a BLIND user!

So, if a mod doesn't install properly, and I can't get help from your part of the forum,
I will come begging for YOUR help since you wrote it and know how it works
um, uh, well,
At least I would really, really hope you do!
HEE-HEE-HEE

tmdg

Quote from: ke4obt on January 30, 2009, 09:05:53 PM
Tom,
there is one wee, little problem - the edit to modifications.english.php are going AFTER the closing ?> tag. It should go BEFORE.
I fixed that manually and it works beautifully! Before I fixed it, though, had a page FULL of errors.
Have you figured out how to put a timezone offset into it? Our server is set to mountain time USA (no DST for the server), and our site is set to GMT. So, I have to remember to set it 7 hours different.

Thanks,
Flip

Yes I have a working Timezone version.  :-)

I wanted to get the package to do an update before posting it here I should have it working later this week end.

regards,
Tom.

tmdg

#33
Hi,

Attached is my TimeZone aware version of the CountDown Timer.

I've tried everything I can to create an update package but it looks to me like that functionality is not there yet.   So you will need to uninstall the previous version before installing this version.

The read me has a new example :-

[countdown=month,day,year,hour,minute,,TimeZone]some text[/countdown]

Note the two commas after the minute.  The NULL parameter is for future use I think I will need it to allow the specification of time during the change from Daylight Saving to Standard time.

When going from Standard time to Daylight Saving time things are easy since the time goes:-

00:00:58 GMT
00:00:59 GMT
02:00:00 BST
02:00:01 BST

So if you put 01:30:00 GMT as the time on the day the clocks are advanced the system automagically  corrects it to 02:30:00 BST

However,   when the clocks go back it's more tricky since there are two  1 O'Clocks
So the time goes :-

01:59:58   BST
01:59:59   BST
01:00:00  GMT
01:00:01  GMT
...
01:59:58  GMT
01:59:59  GMT
02:00;00 GMT
02:00:01 GMT

So I need a flag so that you can indicate if you mean 01:00 -> 01:59  BST or 01:00 -> 01:59 GMT.

I'm still working on that.

The TimeZone needs to be a Linux Timezone name.

http://multigraph.sourceforge.net/multigraph/doc/a262.htm should help you choose a name if you don't know what to choose.

There is a bug in the persian  language part I haven't got a clue what should be there.
So I just dumped in English words for week and weeks.  Sorry.

You do NOT need to change any existing posts to include a timezone they will continue to work in the way they did before.

Regards,
Tom.


tmdg

Quote from: ke4obt on January 30, 2009, 09:23:29 PM

So, maybe you all can help me with another little thing. I would like to add another clock to the header/top of the forum (where the forum clock already is) that says "Forum Time". Then put a tag on the  "default" clock that says "Your Time". Also, put a permission on it so that the "your time" clock doesn't show up unless you're logged in. (not sure if that would really be a permission, but whatever - tag, hidden permission).
appreciated.
Just as a reminder, since I use a screen reader - it doesn't read ALL characters unless I do it manually by using the cursor keys to go one letter/character at a time.

I think the Timezone Select package might be one solution you could try.  This won't do anything like what you want but I wonder if that is what you are really trying to archive.

in the UNIX/Linux/BSD world the system clock is set to UTC then a user sets the Timezone to whatever zone he feels is appropriate.

Personally I have my server set to UTC as the  timezone mostly because I use the system to serve Avaiation weather data and in Aviation all times are UTC.

However, Most UK based servers would have the TimeZone set to Europe/London. A server in say New York would have the  TImeZone set to US/Eastern. 

Now at Midday in London during December the system Clock would show 12:00 UTC in both systems.   
On the UK server date would show as 12:00:00 GMT
On the US server date would show as 07:00:00 EST

If we now look at midday in London during June the system Clock would show 11:00 UTC

On the UK server date would show as 12:00:00 BST
On the US server date would show as 07:00:00 EDT

I'm not really sure why anyone would care what timezone the apache web server thinks it is in.

If you really need it I could most likely create you a mod to do what you want.

Tom.

P.S.  I'm not a Ham but my father was G3DBL.  Many a night I would go to sleep listening to him "CQ CQ CQ-DX  This is G3 Dog Baker London Calling CQ-DX listening for Weak Stateside stations.".   In the morning he would proudly announce to us how may stations he had  worked as their "First G".  The trouble was he rarely responded to the QSL Cards.

t.

ke4obt

Tom,
this is Mickey, replying for Flip.
He got the new "edition" of the countdown mod installed (all by himself)  :D
The only problem we have is that our server is in Mesa, Arizona which is always 7 hours different than GMT. Flip tried to put in GMT, but it wouldn't take it, but is GMT what needs to go in? He said he didn't understand the link you posted. He put in Greenwich since it was in the list, but wasn't sure if the time listed for Greenwich on the site changed or not - if it's "true" GMT or the "local" time for Greenwich. If that's not the right time zone, which one do we need to use so that the timer uses GMT instead of the server's time?
Check your PM box, I'm going to send you a note about the clock thing that Flip was talking to you about. Don't want to take the thread off topic. :)

73,
Mickey
Thanks Much

Flip - KE4OBT
     The Blind Ham
Helping other blind hams
get on the air!


Yes I am really a BLIND user!

So, if a mod doesn't install properly, and I can't get help from your part of the forum,
I will come begging for YOUR help since you wrote it and know how it works
um, uh, well,
At least I would really, really hope you do!
HEE-HEE-HEE

tmdg

Quote from: ke4obt on February 01, 2009, 12:11:46 PM
Tom,
this is Mickey, replying for Flip.
He got the new "edition" of the countdown mod installed (all by himself)  :D
The only problem we have is that our server is in Mesa, Arizona which is always 7 hours different than GMT. Flip tried to put in GMT, but it wouldn't take it, but is GMT what needs to go in? He said he didn't understand the link you posted. He put in Greenwich since it was in the list, but wasn't sure if the time listed for Greenwich on the site changed or not - if it's "true" GMT or the "local" time for Greenwich. If that's not the right time zone, which one do we need to use so that the timer uses GMT instead of the server's time?
Check your PM box, I'm going to send you a note about the clock thing that Flip was talking to you about. Don't want to take the thread off topic. :)

73,
Mickey

Hi Flip, Mickey,

I think you need  to use   Etc/GMT or Etc/UTC

So you might write
[countdown=6,1,2009,12,0,,Etc/GMT]It's Midday on June 1st[/countdown]

Tom.

Eyesman

Hello all.. i have installed the mod but I don't see it anywhere?

From where do I enable it?

My smf v. is 1.1.8

thanx!

LightningMk6

#38
Have just installed the Mod, and it works fine, just need to find out what files need editing now to change the misspelling of "remaning" to remaining.

Anyone know which files to edit please?

[unplugged]

Quote from: SunKing on December 26, 2008, 07:16:36 PM
And there is a typo in the english language file. "remaning" should be "remaining".
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Advertisement: