mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#27672 02/06/03 06:26 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
I think it's long overdue that $duration should get the ability to put it into day/hour/minute/second format. Sure, it can be scripted. But it would be nice if we could simply use $duration(1000000,3) to return 11days 13hrs 46mins 40secs and $duration(1000000,4) to return 11days 13hrs 46mins.

#27673 02/06/03 07:45 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
huh?

#27674 02/06/03 08:28 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
$duration reports it with weeks, days, hours, minutes, and seconds or without seconds. I'd enjoy it if we can have another option to convert weeks to days, so instead of 2 weeks 2 days, we'd get 16 days.

#27675 02/06/03 08:30 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Ah ok, now I understand.

#27676 02/06/03 08:32 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Examples of the current way.

$duration(1029238,1) returns 1wk 4days 21hrs 53mins 58secs

$duration(1029238,2) returns 1wk 4days 21hrs 53mins

My suggestion.

$duration(1029238,3) returns 11days 21hrs 53mins 58secs

$duration(1029238,4) returns 11days 21hrs 53mins

#27677 02/06/03 08:35 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
At one point, there wasn't the 2nd option to $duration. Then it was added. Or at least I think so. It's not too hard for him to do. And it does take a bit of scripting to actually do something like this. I currently use the below.

alias durr var %n | if ($1 < 0) { set %n - | tokenize 32 $right($1,-1) } | if ($1 < 604800) { return %n $+ $duration($1) | halt } | else { return %n $+ $iif(wk isin $gettok($duration($1),1,32), $calc(($remove($gettok($duration($1),1,32),w,k,s) * 7) + $iif(day isin $gettok($duration($1),2,32), $remove($gettok($duration($1),2,32),d,a,y,s), 0)) $+ days) $+ $remove($duration($1),$iif($wildtok($duration($1),*wk*,1,32), $wildtok($duration($1),*wk*,1,32),X),$iif($wildtok($duration($1),*day*,1,32), $wildtok($duration($1),*day*,1,32),X)) }

#27678 03/06/03 03:45 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
How about adding years onto duration? I know that months were not added because of the variability of one being 30 days, the other 31, and some 28/9 (dep3ending on leap year), but 52 weeks being a year would be nice. Or even 52wks 6hrs == 1 year >:D


-KingTomato
#27679 03/06/03 05:55 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
But with years you still have the leap year problem. Is a year 365 days? 366 days? 365.25 days?

#27680 03/06/03 05:58 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
like i aid, 52wks 6hrs == 365days 6hrs == 1 "year"


-KingTomato
#27681 03/06/03 06:12 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yes but my point is you can never be 100% accurate. There is more to leap years than just "every 4 years" if you do some google searchs you'll find that the rules for leap year are rather complex, and they even vary from country to country. For example, in some countries the year 2000 was a leap year, and in others it was not. Another example (that I happen to know for a fact) is that the year 2800 is a leap year in the US, and it is NOT a leap year in Greece (they use different rules for determining it). In the US the rule is if year/100 % 4 == 0, it's a leap year. In Greece the rule is year % 900 == (200 || 600), it's a leap year. My point is just that answering the question of "what is a year" is more difficult than it may seem.

#27682 03/06/03 06:32 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
365.24219 is a solar year. But it wouldn't be worth it. Neither would a lunar month. The next best thing is to take weeks and merge it into days. Merging everything into hours would be a huge number that wouldn't work I think, for those thinking of that.

#27683 03/06/03 07:50 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
It wouldn't be TOO huge of a number. After all, as of this post, there have only been 1,054,626,523 seconds since Jan 1 1970. mIRC is more than capable of handling numbers of that size, and larger, before it starts going E+20.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#27684 03/06/03 06:39 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I don't think he meant huge to a computer, I think he meant huge to a person, 18720hours 43minutes 32seconds, that is sorta meaningless to a person, how many days is 18720 exactly? Unless you take the time to calculate the math, it wouldn't be too obvios.

#27685 03/06/03 08:22 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Exactly. Like on DALnet, I use $durr to calculate the time I have registered my nick for. $durr is converting weeks to days. So instead of whatever it would be in weeks, I get 1263 days. I sure hope Khaled reads this post.

#27686 04/06/03 08:41 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I don't see how guestimating a year at 365 days is a bad thing. Its not like the result of duration is going to be used by nasa to calculat some scientific number that needs to be carried to the nearest one-hundred thousandth decimal. 52 weeks into 1 year would just be a nice addition. Anyways, how exact is one day in comparison to one year is the terms you were talkin about code. If one year isn't exactly 365days (24*365 hours), then what is one day's length? 23.26+E23 hours?


-KingTomato
#27687 04/06/03 09:04 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
No. A second is a second. A minute is 60 seconds. An hour is 60 minutes. A day is 24 hours. A week is 7 days. A year is always different. You can't say a year is 52 weeks cause it's not. And you can't say it's the solar year length cause it's not. A year is many things. It's way to complicated. If he added a year option, he'd have to add so many year options.

#27688 04/06/03 10:37 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Very true, but I'd settle for a 52 week to 1 year dealy, and make up the difference every 7 years by subtracting an extra wk.

That method would be much easier to wrap your mind around, than trying to figure 1yr = 52wk 1day, or worse 1yr = 52wk 1day 6hr 1min

Odds are that few $duration values would ever exceed 364wk/7yr (364/52 = 7) and 365wk/7yr (365*7/365 = 7), or that people would be critical over the extra carried week when viewing such a $duration. And leapyear would be left entirely out of the equation, because there's no way of telling how many times leapyear has occured in any span of time, and also because leapyear isn't observed the same internationally.

Bottom line, 7yr is much easier to read and less painful to the mind.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#27689 05/06/03 04:39 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
I still disagree. 52 weeks is NOT one year.

#27690 05/06/03 04:57 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Oh give me a break, like the average mirc user needs the EXACT duration of a year carried out 100 decimals. Its a chat script people, you celebrate new years every 365 days, not every 365.4352343453 days.


-KingTomato
#27691 05/06/03 12:24 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Also, when you look at a $duration, common logic suggests that units move over to the right when they reach a certain limit. The brain is keen to this simplicity.

1min <- 60sec
1hr <- 60min
1day <- 24hr
1wk <- 7day
1yr <- 52wk


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Page 1 of 2 1 2

Link Copied to Clipboard