All pastes #192307 Raw Edit

pq

public text v1 · immutable
·published 2006-10-05 20:59 UTC
rendered paste body
alias dur {
  if ($1 !isnum) halt
  var %years $floor($calc($1 / 3600 / 24 / 365.242199))
  var %months $floor($calc(($1 - %years * 365.242199 * 24 * 3600) / 3600 / 24 / 30.4375))
  var %wdhs $duration($calc(($1 - (%years * 365.242199 * 24 * 3600) - (%months * 30.4375 * 24 * 3600))))
  return $iif(%years isnum 1-,%years $+ yrs) $iif(%months isnum 1-,%months $+ months) %wdhs
}
alias age {
  if (!$4) tokenize 32 $1-3 00:00
  if ($prop == yearlive) return $calc(($ctime - $ctime($1 $2 $3 $4)) / 3600 / 24 / 365.25)
  elseif ($prop == seclive) return $calc($ctime - $ctime($1 $2 $3 $4))
  elseif ($prop == durlive) return $dur($calc($ctime - $ctime($1 $2 $3 $4)))
  elseif ($prop == durbday) return $iif($calc($ctime($1 $2 $asctime(yyyy) $4) - $ctime) > 0,$dur($calc($ctime($1 $2 $asctime(yyyy) $4) - $ctime)),$dur($calc($ctime($1 $2 $calc($asctime(yyyy) + 1) $4) - $ctime)))
  elseif ($prop == secbday) return $iif($calc($ctime($1 $2 $asctime(yyyy) $4) - $ctime) > 0,$calc($ctime($1 $2 $asctime(yyyy) $4) - $ctime),$calc($ctime($1 $2 $calc($asctime(yyyy) + 1) $4) - $ctime))
}
alias myage { if (!$1) tokenize 32 June 27 1989 00:00 | me has been alive for $age($1,$2,$3,$5).seclive seconds, thats $age($1,$2,$3,$5).durlive $+ ( $+ $age($1,$2,$3,$5).yearlive years). His next birthday is in $age($1,$2,$3,$5).secbday seconds, thats $age($1,$2,$3,$5).durbday which will be $1 $ord($2) $+ . }