Advertisement
westor

$_timeago alias update for VitruxPT

Sep 1st, 2015
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.05 KB | None | 0 0
  1. alias -l _timeago { ; by westor
  2.   if (!$1) { return 0 }
  3.   if ($1) && ($1 !isnum) { return 0 }
  4.   if ($prop == all) {
  5.     var %s = $calc($1 - $remove($timezone,-))
  6.     var %s = $nduration(%s)
  7.     var %s = $replacex(%s,wks,$chr(32) weeks.,wk,$chr(32) week.)
  8.     var %s = $replacex(%s,days,$chr(32) days.,day,$chr(32) day.)
  9.     if (*min* iswm %s) { var %s = $replacex(%s,hrs,$chr(32) hours.,hr,$chr(32) hour.) }
  10.     if (*min* !iswm %s) { var %s = $replacex(%s,hrs,$chr(32) hours,hr,$chr(32) hour) }
  11.     if (*sec* iswm %s) { var %s = $replacex(%s,mins,$chr(32) minutes.,min,$chr(32) minute.) }
  12.     if (*sec* !iswm %s) { var %s = $replacex(%s,mins,$chr(32) minutes,min,$chr(32) minute) }
  13.     var %s = $replacex(%s,secs,$chr(32) seconds,sec,$chr(32) second)
  14.     var %s = $replace(%s,$chr(46),$chr(44))
  15.     return $iif(%s,%s ago,0)
  16.   }
  17.   if ($1 <= 59) { return $1 $iif($1 == 1,second,seconds) ago }
  18.   if (($1 <= 3599) && ($1 > 59)) { return $floor($calc($1 / 60)) $iif($floor($calc($1 / 60)) == 1,minute,minutes) ago }
  19.   if (($1 <= 86399) && ($1 > 3599)) { return $round($calc($1 / 3600),0) $iif($round($calc($1 / 3600),0) == 1,hour,hours) ago }
  20.   if (($1 <= 2592000) && ($1 > 86399)) { return $floor($calc($1 / 86400)) $iif($floor($calc($1 / 86400)) > 1,days,day) $+ , $round($calc($calc($1 - $calc($floor($calc($1 / 86400))*86400)) / 3600),0) $iif($round($calc($calc($1 - $calc($floor($calc($1 / 86400))*86400)) / 3600),0) > 1,hours,hour) ago }
  21.   if (($1 <= 31540000) && ($1 > 2592000)) { return $floor($calc($1 / 2592000)) $iif($floor($calc($1 / 2592000)) > 1,months,month) $+ , $round($calc($calc($1 - $calc($floor($calc($1 / 2592000))*2592000)) / 86400),0) $iif($round($calc($calc($1 - $calc($floor($calc($1 / 2592000))*2592000)) / 86400),0) > 1,days,day) ago }
  22.   if ($1 > 31104000) { return $floor($calc($1 / 31104000)) $iif($floor($calc($1 / 31104000)) > 1,years,year) $+ , $round($calc($calc($1 - $calc($floor($calc($1 / 31104000))*31104000)) / 2592000),0) $iif($round($calc($calc($1 - $calc($floor($calc($1 / 31104000))*31104000)) / 2592000),0) > 1,months,month) ago }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement