| 1 | # -*- perl -*- | ||
| 2 | |||
| 3 | # Copyright (c) 2009 AdCopy | ||
| 4 | # Author: Jeff Weisberg | ||
| 5 | # Created: 2009-Apr-13 12:34 (EDT) | ||
| 6 | # Function: defs | ||
| 7 | # | ||
| 8 | # $Id$ | ||
| 9 | |||
| 10 | package AC::Yenta::Conf; | ||
| 11 | use AC::Yenta::SixtyFour; | ||
| 12 | use AC::Import; | ||
| 13 | use strict; | ||
| 14 | |||
| 15 | our @EXPORT = qw(timet_to_yenta_version_factor timet_to_yenta_version); | ||
| 16 | |||
| 17 | my $TTVF = x64_one_million(); | ||
| 18 | |||
| 19 | |||
| 20 | # deprecated | ||
| 21 | sub timet_to_yenta_version_factor { | ||
| 22 | return $TTVF; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub timet_to_yenta_version { | ||
| 26 | my $t = shift; | ||
| 27 | |||
| 28 | return unless defined $t; | ||
| 29 | return $t * $TTVF unless ref $TTVF; | ||
| 30 | |||
| 31 | # math::bigint does not like to multiply floats | ||
| 32 | my $ti = int $t; | ||
| 33 | my $tf = $t - $ti; | ||
| 34 | |||
| 35 | return $ti * $TTVF + int($TTVF->numify() * $tf); | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; |