+sub base_factor {
+ my ($self) = @_;
+
+ my $cache = $::request->cache('base_factor');
+
+ if (!defined $cache->{$self->id}) {
+ $cache->{$self->id} = !$self->base_unit || !$self->factor || ($self->name eq $self->base_unit) ? 1 : $self->factor * $self->base->base_factor;
+ }
+
+ return $cache->{$self->id};
+}
+
+sub convert_to {
+ my ($self, $qty, $other_unit) = @_;
+
+ my $my_base_factor = $self->base_factor || 1;
+ my $other_base_factor = $other_unit->base_factor || 1;
+
+ return $qty * $my_base_factor / $other_base_factor;
+}
+
+sub is_time_based {
+ my ($self) = @_;
+
+ return any { $_->id == $self->id } @{ SL::DB::Manager::Unit->time_based_units };
+}
+