From: djfiander Date: Fri, 14 Apr 2006 20:05:41 +0000 (+0000) Subject: Sip::timestamp now takes an optional parameter (seconds since the X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ef39f850f0fdf8399f863fe5cf4ee735412e2556;p=working%2FSIPServer.git Sip::timestamp now takes an optional parameter (seconds since the epoch) and generates a timestamp for that time. Default continues to be timestamp of 'now'. --- diff --git a/Sip.pm b/Sip.pm index e9806c5..da92680 100644 --- a/Sip.pm +++ b/Sip.pm @@ -42,7 +42,9 @@ our $field_delimiter = '|'; # Protocol Default our $last_response = ''; sub timestamp { - return strftime(SIP_DATETIME, localtime()); + my $time = $_[0] || time(); + + return strftime(SIP_DATETIME, localtime($time)); } # @@ -52,6 +54,10 @@ sub timestamp { sub add_field { my ($field_id, $value) = @_; + if (!defined($value)) { + syslog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", + $field_id); + } return $field_id . $value . $field_delimiter; } #