-rw-r--r-- | library/backend/timeconversion.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/library/backend/timeconversion.cpp b/library/backend/timeconversion.cpp index ef7762d..3c25922 100644 --- a/library/backend/timeconversion.cpp +++ b/library/backend/timeconversion.cpp @@ -135,3 +135,3 @@ QDateTime TimeConversion::fromISO8601( const QCString &s ) - struct tm *thetime = new tm;
+ struct tm thetime;
@@ -154,8 +154,9 @@ QDateTime TimeConversion::fromISO8601( const QCString &s ) // qDebug("--- parsing ISO time---");
- thetime->tm_year = 100;
- thetime->tm_mon = 0;
- thetime->tm_mday = 0;
- thetime->tm_hour = 0;
- thetime->tm_min = 0;
- thetime->tm_sec = 0;
+ memset( &thetime, 0, sizeof(tm) );
+ thetime.tm_year = 100;
+ thetime.tm_mon = 0;
+ thetime.tm_mday = 0;
+ thetime.tm_hour = 0;
+ thetime.tm_min = 0;
+ thetime.tm_sec = 0;
@@ -165,8 +166,8 @@ QDateTime TimeConversion::fromISO8601( const QCString &s ) case 8:
- thetime->tm_mday = date.right( 2 ).toInt();
+ thetime.tm_mday = date.right( 2 ).toInt();
case 6:
- thetime->tm_mon = date.mid( 4, 2 ).toInt() - 1;
+ thetime.tm_mon = date.mid( 4, 2 ).toInt() - 1;
case 4:
- thetime->tm_year = date.left( 4 ).toInt();
- thetime->tm_year -= 1900;
+ thetime.tm_year = date.left( 4 ).toInt();
+ thetime.tm_year -= 1900;
break;
@@ -208,7 +209,7 @@ QDateTime TimeConversion::fromISO8601( const QCString &s ) case 6:
- thetime->tm_sec = timestr.mid( 4 ).toInt();
+ thetime.tm_sec = timestr.mid( 4 ).toInt();
case 4:
- thetime->tm_min = timestr.mid( 2, 2 ).toInt();
+ thetime.tm_min = timestr.mid( 2, 2 ).toInt();
case 2:
- thetime->tm_hour = timestr.left( 2 ).toInt();
+ thetime.tm_hour = timestr.left( 2 ).toInt();
default:
@@ -229,6 +230,6 @@ QDateTime TimeConversion::fromISO8601( const QCString &s ) - tmp = mktime( thetime );
+ tmp = mktime( &thetime );
tmp += 60*(-tzloc + tzoff);
- delete thetime;
+
|