miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[PATCH] wrong "uptime" on the router without RTC

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs
View previous topic :: View next topic  
Author Message
AlexeyS



Joined: 27 Sep 2009
Posts: 7

PostPosted: Thu Mar 04, 2010 8:08 am    Post subject: [PATCH] wrong "uptime" on the router without RTC Reply with quote

After time synchronization on a router without RTC, UPTIME value equal to ~40 years.

Patch fixes the problem:
Code:

--- ./miniupnpd.c.orig   2009-12-22 20:22:13.000000000 +0300
+++ ./miniupnpd.c   2010-03-03 13:22:40.000000000 +0300
@@ -911,6 +911,11 @@
    /* main loop */
    while(!quitting)
    {
+      /* Correct startup_time */
+      if((startup_time<60*60*24) && (time(NULL)>60*60*24))
+      {
+         set_startup_time(GETFLAG(SYSUPTIMEMASK)/*sysuptime*/);
+      }
       /* Check if we need to send SSDP NOTIFY messages and do it if
        * needed */
       if(gettimeofday(&timeofday, 0) < 0)
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1497

PostPosted: Mon Mar 08, 2010 5:49 pm    Post subject: Reply with quote

thanks for the patch.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.