diff --git a/src/mtime_iso8601.c b/src/mtime_iso8601.c
index bf7397199dfe95ffdcb1bc6f91623e32ad63b50a..256d56786e11b043d994a2f820f9c3edebbd51d4 100644
--- a/src/mtime_iso8601.c
+++ b/src/mtime_iso8601.c
@@ -634,7 +634,8 @@ _match:
 	    int _ms;
             int _seconds;            
             div_t _split;
-            
+
+	    strncpy( _du_second, ts, (size_t)(te-ts));
             if (strstr(_du_second,"."))
 	      {
 		_du_ms = (strstr(_du_second,".")+1);
@@ -670,7 +671,7 @@ _match:
             duObj->second = _seconds - duObj->minute * 60;
 	  }
 	break;
-#line 674 "mtime_iso8601.c"
+#line 675 "mtime_iso8601.c"
 		}
 	}
 
@@ -683,7 +684,7 @@ _again:
 	_out: {}
 	}
 
-#line 557 "mtime_iso8601.rl"
+#line 558 "mtime_iso8601.rl"
 
     
 }
diff --git a/src/mtime_iso8601.rl b/src/mtime_iso8601.rl
index 9bade13a607a0d03bc174c7e3ed8ffcfd6170f3b..c0cb1ebe24afd9eaca1ad164ee3844b3658ca5cb 100644
--- a/src/mtime_iso8601.rl
+++ b/src/mtime_iso8601.rl
@@ -282,7 +282,8 @@ date_machine( char *str, ISO8601_STATUS* stat, struct internal_datetime* dtObj,
 	    int _ms;
             int _seconds;            
             div_t _split;
-            
+
+	    strncpy( _du_second, ts, (size_t)(te-ts));
             if (strstr(_du_second,"."))
 	      {
 		_du_ms = (strstr(_du_second,".")+1);
diff --git a/test/duration.f90 b/test/duration.f90
index 66a5de0454ba54feec5e3567df3280090b72bc96..d3bf3ff3432595cc01ae65e35e7844ea0e59ee3a 100644
--- a/test/duration.f90
+++ b/test/duration.f90
@@ -16,6 +16,7 @@ program duration
   call testTimedelta('PT10S', 'PT10.000S')
   call testTimedelta('PT1S', 'PT01.000S')
   call testTimedelta('PT100S', 'PT01M40.000S')
+  call testTimedelta('PT100.5S', 'PT01M40.500S')
   call testTimedelta('PT934565S', 'P10DT19H36M05.000S')
   call testTimedelta('P02DT06H', 'P02DT06H')
   call testTimedelta('P2DT6H', 'P02DT06H')