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!
#27692 06/06/03 04:32 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
A year is NOT 52 weeks.

#27693 06/06/03 04:45 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
But it is.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#27694 06/06/03 07:20 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Actually, a year is NOT 52 weeks. I don't know where you get that. A year is 52 weeks and 6 hours. A year is 52 weeks and one day. A year is 52 weeks and 2 days. A year is 53 weeks. A year is many things. Too many problems. As for what I suggested before, a week can be converted back into days for those who want them.

The only thing a year is constant on is a solar year. So if he took seconds divided by how many seconds in a solar year, that would be okay, yet it wouldn't serve much purpose since our calendar doesn't work that way.

#27695 06/06/03 07:36 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Hours and Seconds cannot jump into Years. They must form whole Minutes and whole Hours and whole Days and whole Weeks, before they can become Years. At least, that's how $duration works. As I said, after 365 weeks, the 'leap week' can be taken into consideration, and most likely wouldn't have much significants to anyone. I don't care if the year had a blue moon or solar eclipse in it, I just care about turning '52' into a '1' and '104' into a '2' so it reads better.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#27696 06/06/03 10:41 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Maybe it should work like this. Cause I'd hate it like that. I hope I did the below correctly. I used $int not $round, for the reason that we shouldn't round up since it's not actually that duration yet.

$duration(192891822) would return 318wks 6days 13hrs 3mins 42secs

$duration(192891822,2) would return 318wks 6days 13hrs 3mins

$duration(192891822,3) would return 2232days 13hrs 3mins 42secs

$duration(192891822,4) would return 2232days 13hrs 3mins

$duration(192891822,5) would return 6yrs 5wks 6days 2hrs 11mins 10secs

$duration(192891822,6) would return 6yrs 5wks 6days 2hrs 11mins

----
Some of my work I used below.
//echo -s $duration(192891822) $duration($int($calc((192891822/(365.24219*60*60*24) - 6) * (365.24219*60*60*24))))
----
I'd like it with solar years, since no matter how long it is, it will eventually end up going off to solar years.

#27697 08/06/03 12:45 AM
Joined: Jan 2003
Posts: 154
B
Vogon poet
Offline
Vogon poet
B
Joined: Jan 2003
Posts: 154
For most intents and purposes, who cares about the 1/4th of a day for every 365 days? Even if it is never included in the script, it won't make much of a difference..

Come on guys.. There's this little something called "diminishing returns", where as a number grows larger (positively or negatively), additional numbers added or subtracted from it become less and less valueable towards the significance of the number. For example: If someone sees "you've been running this script for 1 day 5 hours and 20 seconds". Then they see "You've been running this script for 200 days 4 hours and 47 seconds", that is quite a difference and it is noticeable. If the script says "You've been running this script for 4 years 147 days 13 hours and 13 seconds" and it's off by 1 day, does that really matter? (even more importantly, would the person notice that the script didn't subtract the extra day?) I doubt anyone is going to run the dang script for 4 years anyways. lol

Why argue about things that are so trivial? 52 weeks is about a year, and if it is just an option to include years instead of amassing weeks, why not?

Khaled should debate an issue that is more useful, not one that'll make a days difference every 4 years for some script.

For the rare occasion when someone NEEDS it to be exact, they can script it.. I don't see why that's really that hard. The person could just simply go with the format as it is now, using weeks as their main unit of measurement.


- Wherever you go there you are.[color:lightgreen]
#27698 08/06/03 01:42 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
A year is NOT 52 weeks though. If Khaled did do it, it should simple be done with solar years, since that will always be accurate. With what you said, you are claiming inaccuracy is a good thing.

#27699 08/06/03 04:29 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Google says that 2800 websources agree, "there are 52 weeks in a year".
Only one lonely page suggests that "there are NOT 52 weeks in a year".

And incidentally, that one page tells us to ignore that a year is slightly longer than 52 weeks, because in the end, the information is trivial for the effort put into figuring it out.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#27700 08/06/03 04:49 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You're right, they could script that, so why can't someone who needs years, just script that? It's not exactly hard to do.

Code:
alias yrsduration {
  var %dur = $duration($1)
  tokenize 32 %dur
  if (wk !isin $1) return %dur
  var %weeks = $calc($1)
  var %years = $int($calc(%weeks / 52))
  %weeks = $calc(%weeks % 52)
  var %output
  if (%years) %output = %years $+ $iif(%years &gt; 1,yrs,yr)
  if (%weeks) %output = %output %weeks $+ $iif(%weeks &gt; 1,wks,wk)
  return %output $2-
}


Is that so terribly hard to do that it must be added directly into mIRC?

#27701 08/06/03 04:58 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Well, I originally had this post for changing weeks into days, since thats something everyone can agree on. Since one week is always 7 days, plain and simple. I'm going to just drop the subject of years, since this is too opinionated.

#27702 08/06/03 05:10 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well what about something like "I turn 21 in 2yrs 2days 4hours"
If I change that "2days" into "3days" well now it's no longer correct seeing as how I just changed the day on which I was born. For some purposes it is insignifigant, for others it is very signifigant.

Page 1 of 2 1 2

Link Copied to Clipboard