save the timestamp only once
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 22 Sep 2008 12:24:29 +0000 (12:24 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 22 Sep 2008 12:24:29 +0000 (12:24 +0000)
tools/repo_repomdxml.c

index 05935c8..095c9db 100644 (file)
@@ -293,28 +293,32 @@ endElement(void *userData, const char *name)
   switch (pd->state)
     {
     case STATE_START: break;
-    case STATE_REPOMD: break;
+    case STATE_REPOMD: 
+      /* save the timestamp in the non solvable number 1 */
+      if ( pd->timestamp > 0 )
+        repo_set_num(pd->repo, -1, REPOSITORY_TIMESTAMP, pd->timestamp);
+      break;
     case STATE_DATA: break;
     case STATE_LOCATION: break;
     case STATE_CHECKSUM: break;
     case STATE_OPENCHECKSUM: break;
     case STATE_TIMESTAMP:
-      /**
-       * we want to look for the newer timestamp
-       * of all resources to save it as the time
-       * the metadata was generated
-       */
-      timestamp = atoi(pd->content);
-      /** if the timestamp is invalid or just 0 ignore it */
-      if ( timestamp == 0 )
+      {
+        /**
+         * we want to look for the newer timestamp
+         * of all resources to save it as the time
+         * the metadata was generated
+         */
+        timestamp = atoi(pd->content);
+        /** if the timestamp is invalid or just 0 ignore it */
+        if ( timestamp == 0 )
+          break;
+        if ( timestamp > pd->timestamp )
+          {
+            pd->timestamp = timestamp;
+          }
         break;
-      if ( timestamp > pd->timestamp )
-        {
-          pd->timestamp = timestamp;
-          /* save the timestamp in the non solvable number 1 */
-          repo_set_num(pd->repo, -1, REPOSITORY_TIMESTAMP, pd->timestamp);
-        }
-      break;
+      }
     case STATE_EXPIRE:
       {
         int expire = 0;