summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Duedal <hd@onlinecity.dk>2011-10-04 17:18:05 +0200
committerHans Duedal <hd@onlinecity.dk>2011-10-04 17:18:05 +0200
commit2f41801e80b664d59849f4cc77f593e167bf8ef5 (patch)
tree4b7fc7684346a4509379c6d86a57b8c1a254f474
parent4f0636332875cb5ee9268bfdd489f8e2a5127f83 (diff)
downloadphp-smpp-2f41801e80b664d59849f4cc77f593e167bf8ef5.zip
php-smpp-2f41801e80b664d59849f4cc77f593e167bf8ef5.tar.gz
php-smpp-2f41801e80b664d59849f4cc77f593e167bf8ef5.tar.bz2
Fixed UTC offset symbol bug, where it was hardcoded as positive
-rw-r--r--smppclient.class.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/smppclient.class.php b/smppclient.class.php
index 1e35fcf..bbe6c46 100644
--- a/smppclient.class.php
+++ b/smppclient.class.php
@@ -141,11 +141,12 @@ class SmppClient
/**
* Parse a timestring as formatted by SMPP v3.4 section 7.1.
- * Returns an unix timestamp if $newDates is false or DateTime/DateInterval is missing
+ * Returns an unix timestamp if $newDates is false or DateTime/DateInterval is missing,
+ * otherwise an object of either DateTime or DateInterval is returned.
*
* @param string $input
* @param boolean $newDates
- * @return int
+ * @return mixed
*/
public function parseSmppTime($input, $newDates=true)
{
@@ -174,7 +175,7 @@ class SmppClient
} else {
$offsetHours = floor($n/4);
$offsetMinutes = ($n % 4)*15;
- $time = sprintf("20%02s-%02s-%02sT%02s:%02s:%02s+%02s:%02s",$y,$m,$d,$h,$i,$s,$offsetHours,$offsetMinutes); // Not Y3K safe
+ $time = sprintf("20%02s-%02s-%02sT%02s:%02s:%02s%s%02s:%02s",$y,$m,$d,$h,$i,$s,$p,$offsetHours,$offsetMinutes); // Not Y3K safe
if ($newDates) {
return new DateTime($time);
} else {
@@ -1226,4 +1227,4 @@ class SmppTag
{
return pack('nn'.$this->type, $this->id, ($this->length ? $this->length : strlen($this->value)), $this->value);
}
-} \ No newline at end of file
+}