mIRC Home    About    Download    Register    News    Help

Print Thread
#89136 04/07/04 12:01 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
How does the $timezone identifier work please?

mIRC helpfile says:
$timezone
This returns your current timezone setting in seconds.

if i type in mIRC: //say $duration($timezone,1) - it gives me an output of 0secs . I just wondered if there was actually a rational use for this identifier, and if so what is it?

Thanks in advance grin

#89137 04/07/04 12:23 PM
Joined: Mar 2004
Posts: 108
X
Vogon poet
Offline
Vogon poet
X
Joined: Mar 2004
Posts: 108
$timezone just returns your internal clocks setting.
im gmt-5 (eatern us/canada) so it returns 18000.
//echo -a $calc($timezone / 3600) returns 5
//echo -a $duration($timezone,1) returns 5hrs
as for a use i guess it has its uses.. though i never needed it.
not really much to explain about it..

-hope that helped at least a little -cheers


sometimes these are as bad as quit messages :tongue:
#89138 04/07/04 12:29 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
$timezone gives you the number of seconds +/- you are to GMT.. from the look at your location your in the UK which is GMT+1 at the moment (after daylight savings).

If you go into the Windows clock settings and set yourself to any other timezone, you'll find //echo -> $timezone returns something other than 0.

Eamonn.

#89139 04/07/04 12:36 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
Thanks very much guys grin

I guess being in the UK meant I got a $timezone of 0secs, even though $daylight gives me an output of 3600. Weird.

Forgive me for being thick today... it was a late one last night
L laugh L

#89140 04/07/04 12:49 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Yeah $daylight returns the offset (which to my knowledge is never more/less than an hour).

More than likely you have the little box "automatically adjust for summer daylight savings" in your clock settings clicked, and as a result "GMT" is now "GMT+1".

Its confusing if you ask me because there are 2 sets of GMT, GMT that the UK follows (GMT+1 at the moment) and GMT the rest of the world uses (GMT(an hour behind GMT+1) at the moment).

Eamonn.

#89141 04/07/04 01:03 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
yeah hehe laugh

Thanks again m8... much appreciated

#89142 04/07/04 01:20 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
//echo -a $duration($remove($timezone,-),1) - this gives me an output in hours format

//echo -a $duration($timezone,1) - this just gives me the number of seconds laugh

#89143 04/07/04 01:28 PM
Joined: Mar 2004
Posts: 108
X
Vogon poet
Offline
Vogon poet
X
Joined: Mar 2004
Posts: 108
yeah there are a couple ways to do it,, laugh i still dont see a real use for it in anything i would do,, lol but its there so maybe some day ill need it smile

-cheers


sometimes these are as bad as quit messages :tongue:
#89144 04/07/04 02:08 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
//say $iif(- !isin $duration($timezone,1),GMT -,GMT +) $+ $duration($remove($timezone,-),1)

Try that LOL laugh
I've been messing about with code trying to get an accurate output for a users respective $timezone (that is if their internal clock has been set properly). Anyone got any ideas for shorter code for the same output effect?

Thanks again...

#89145 04/07/04 04:40 PM
Joined: Feb 2004
Posts: 54
Cyclone Offline OP
Babel fish
OP Offline
Babel fish
Joined: Feb 2004
Posts: 54
//say $iif(- isin $duration($timezone,1) || ($timezone == 0),GMT + $+ $duration($remove($calc($timezone + $daylight),-,secs),2),GMT - $+ $duration($timezone,2))

This code includes daylight saving changes. So at the moment, the UK $timezone is GMT +1hr, making EST -6hrs and not the usual -5hrs when GMT is in effect.

Does this seem correct? LgrinL


Link Copied to Clipboard