mIRC Home    About    Download    Register    News    Help

Print Thread
$duration #118580 26/04/05 05:56 PM
Joined: Feb 2004
Posts: 20
S
Salz Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Feb 2004
Posts: 20
hm... i miss some feature with $duration, because it have only 3 fix "styles".
I think it would be nice to give some format, like in other functions like $asctime.

i.e.:
Code:
$duration(4503782,dd)

would be return 52.127106

Re: $duration #118581 26/04/05 06:01 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
I agree that this would be useful at times. You can manually do this without much difficulty, but there's no reason not to have it built-in to $duration. It would also be nice to have $duration display months and/or years as well as just weeks and under. As with the other suggestion, this can also be done manually without difficulty, but having it built in would be nice.


Invision Support
#Invision on irc.irchighway.net
Re: $duration #118582 26/04/05 08:43 PM
Joined: Dec 2002
Posts: 208
H
Hrung Offline
Fjord artisan
Offline
Fjord artisan
H
Joined: Dec 2002
Posts: 208
Quote:
It would also be nice to have $duration display months and/or years as well as just weeks and under.


The problem, I think, is that months and years are not all the same length. Every 4 years, excluding those that are divisible by 100 but not by 400 (confusing?), we have an extra day in the year. Additionally, our months vary in length between 28 and 31 days. It's not so hard to calculate if you assume one of the end points to be the current date, but if you are calculating the time span between two arbitrary dates, all you are left with is a number of seconds, which can't be attributed to any specific span of months or years. All you can do is count weeks, days, hours, etc. since they are all of specific lengths. I would prefer that mIRC be accurate than spit out some incorrect information that merely looks good.

It would be possible to add an $identifier that takes a number of seconds and a start/stop $ctime, or just two $ctime values (one for start and one for stop) and output an exact time span, including months/years. This is something that I might find useful.

My thoughts kinda petered out there, so I'll just post


If I knew now what I will know then... maybe things will have been different...
Re: $duration #118583 26/04/05 09:06 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Well, for years, you can take it as:

a) 52 weeks = 1 year (yes, it's not that accurate)
b) 365.25 days = 1 year (very accurate... just round it and the most you can be off is one day)
c) 365 days = 1 year... x2 = 2 years, x3 = 3 years, x4+1 = 4 years (again, the most you can be off is one day)

For months, you can take it as:

a) 4 weeks = 1 month (not accurate of course)
b) 30.4375 days = 1 month (very accurate... as above, round and you're only off by a day or perhaps 2 at most)

Nothing is perfect, but if there is an option on the $duration for formatting as suggested previously, then you can choose to have the display show the years/months or to show it as it does now. Perhaps the way it is now can be a default if nothing is entered as a format.

Personally, I see nothing wrong with having extra *options* that people can use if they prefer a specific output or control or whatever if it is easy to add. If some people aren't interested, they can keep using things the same way and they don't have to use the new options. smile


Invision Support
#Invision on irc.irchighway.net
Re: $duration #118584 26/04/05 11:47 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Since duration gives you a duration of time, and there is no fixed times above "week" it makes sence that it stops at this.
if you went $duration(31536000) *365x24x60x60 and it came back with 1yr, that may or maynot be correct based apon what start date you apply it to

If its applied to 22 feb you would think one year later is 22 feb but you might find that thats actually needs to be 31622400 366x24x60x60, becuase that year was a leap year.
While if $duration replied with what it does 52wks 1day, while its not particually help full to you, if you did a pply that to the 22 feb date you end up on 21st feb (assuming as above its a leap year)

All im really trying to say i guess is unless you give it a starting date, theres no way to acuaratly reply with a number of months and years in duration, is 28days a month or 29 or 30 or 31? Dont know unless you tell me where im starting from. 22feb/2003 its 28, 2004 it was 29, any april its 30 and march its 31.

You could have an extra field to duration i guess with a start date to offset from?!?!?!

Re: $duration #118585 27/04/05 02:27 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
As I said, it can be done in such a way where you are never more than one day off. And, if someone needs more accuracy, then they can use the current format. My point is simply that there's no reason not to allow the extended format to be available for those who do not need perfect accuracy. If you're viewing $uptime, for example, do you need to know it to the day?


Invision Support
#Invision on irc.irchighway.net
Re: $duration #118586 27/04/05 11:11 PM
Joined: Mar 2004
Posts: 540
A
Armada Offline
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
Quote:
Well, for years, you can take it as:
a) 52 weeks = 1 year (yes, it's not that accurate)
b) 365.25 days = 1 year (very accurate... just round it and the most you can be off is one day)
c) 365 days = 1 year... x2 = 2 years, x3 = 3 years, x4+1 = 4 years (again, the most you can be off is one day)
a) 4 weeks = 1 month (not accurate of course)
b) 30.4375 days = 1 month (very accurate... as above, round and you're only off by a day or perhaps 2 at most)

If this is done then this forum will be flooded with "why does my mirc say its been a year or a month and it hasnt!?!?!?!?!"
Built in features would be nice, but Id avoid this side of it

Re: $duration #118587 28/04/05 12:50 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Lol. That is why I suggested using the current format as a default. And you can use the extended format with a format option as the other guy mentioned.

$duration(3452345,y m d h n s) for example

I'd also like to format the output a bit more than that as well... for example, I personally do not like seeing something like:

2mins 3secs

I'd rather have it with spaces:

2 mins 3 secs

So, you might have the options like this:

s.....................3, 25
ss...................03, 25
sss.................3secs, 25secs (the default output)
s seconds........3 seconds, 25 seconds
s secs.............3 secs, 25 secs

That sort of thing. Obviously, there'd have to be some way to let mIRC identify what is the "s" "ss" "sss" for viewing the actual number, and what is the text part if you want to make the output your own way. This can also be nice for people wanting it in a foreign language output (ie. not English).

Yes, I can easily do this manually. It's still nice to have it built-in.


Invision Support
#Invision on irc.irchighway.net
Re: $duration #118588 04/05/05 02:21 AM
Joined: Apr 2004
Posts: 73
Z
Zelda4ever32 Offline
Babel fish
Offline
Babel fish
Z
Joined: Apr 2004
Posts: 73
I would like to see this feature added too.

-Zelda4ever


/tokenize 32 $gettok($1-,1-,32)