diff --git a/ChangeLog b/ChangeLog
index 5c7fa35ee87513255c4e2b082ec3fea52198373b..3dd19d4e09ca0f466d20318d8a65f61b99d72626 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-11-01  Kevin P. Fleming  <kpfleming@digium.com>
 
+	* stdtime/localtime.c: fix build failure on uClibc systems (issue #5558)
+	* devicestate.c: same
+
 	* many files: make chan_misdn actually build (issue #5566)
 
 	* many files: more Cygwin build system support (issue #4678)
diff --git a/devicestate.c b/devicestate.c
index 92fb5eb9b5717e0eafc2f5eb589e78c5edca23d3..73b77956833aa03fef5e37bd4d85e38311af9fb2 100755
--- a/devicestate.c
+++ b/devicestate.c
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 #include "asterisk.h"
 
diff --git a/stdtime/localtime.c b/stdtime/localtime.c
index 248f206211854a801acf10c7d370ad532313bae1..b177d3cd4f033c32d96c426ef57112639a16cd90 100755
--- a/stdtime/localtime.c
+++ b/stdtime/localtime.c
@@ -39,15 +39,6 @@
 #endif
 #define TZ_STRLEN_MAX	255
 /* #define DEBUG */
-#include "asterisk/lock.h"
-#include "asterisk/localtime.h"
-
-
-#ifndef lint
-#ifndef NOID
-static const char	elsieid[] = "@(#)localtime.c	7.57";
-#endif /* !defined NOID */
-#endif /* !defined lint */
 
 /*
 ** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu).
@@ -59,12 +50,23 @@ static const char	elsieid[] = "@(#)localtime.c	7.57";
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "private.h"
-#include "tzfile.h"
 #include <fcntl.h>
 #ifdef DEBUG
 #include <stdio.h>
 #endif
+#include "private.h"
+#include "tzfile.h"
+#include "asterisk/lock.h"
+#include "asterisk/localtime.h"
+
+
+#ifndef lint
+#ifndef NOID
+static const char	elsieid[] = "@(#)localtime.c	7.57";
+#endif /* !defined NOID */
+#endif /* !defined lint */
+
+
 
 /*
 ** SunOS 4.1.1 headers lack O_BINARY.