Index: uspace/app/ps/ps.c
===================================================================
--- uspace/app/ps/ps.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/ps/ps.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -130,7 +130,13 @@
 static void echo_load(void)
 {
-	size_t load[3];
+	unsigned long load[3];
 	get_load(load);
-	printf("System load: %d.%03d %d.%03d %d.%03d\n", ECHOLOAD1(load[0]), ECHOLOAD2(load[0]), ECHOLOAD1(load[1]), ECHOLOAD2(load[1]), ECHOLOAD1(load[2]), ECHOLOAD2(load[2]));
+	printf("load avarage: ");
+	print_load_fragment(load[0], 2);
+	puts(" ");
+	print_load_fragment(load[1], 2);
+	puts(" ");
+	print_load_fragment(load[2], 2);
+	puts("\n");
 }
 
Index: uspace/app/top/input.c
===================================================================
--- uspace/app/top/input.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/top/input.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -62,5 +62,5 @@
 #include <ipc/console.h>
 
-#define READ_TIMEOUT 1000000
+#define USEC_COUNT 1000000
 
 /* return true iff the given timeval is positive */
@@ -154,10 +154,10 @@
  * Eat any input that might be available.
  */
-void tsleep(void)
+void tsleep(unsigned int sec)
 {
 	struct timeval tv;
 	
 	tv.tv_sec = 0;
-	tv.tv_usec = READ_TIMEOUT;
+	tv.tv_usec = sec * USEC_COUNT;
 	while (TV_POS(&tv))
 		if (rwait(&tv)) {
@@ -170,5 +170,5 @@
  * getchar with timeout.
  */
-int tgetchar(void)
+int tgetchar(unsigned int sec)
 {
 	static struct timeval timeleft;
@@ -176,5 +176,5 @@
 	
 	/*
-	 * Reset timeleft to READ_TIMEOUT whenever it is not positive.
+	 * Reset timeleft to USEC_COUNT whenever it is not positive.
 	 * In any case, wait to see if there is any input.  If so,
 	 * take it, and update timeleft so that the next call to
@@ -186,5 +186,5 @@
 	if (!TV_POS(&timeleft)) {
 		timeleft.tv_sec = 0;
-		timeleft.tv_usec = READ_TIMEOUT;
+		timeleft.tv_usec = sec * USEC_COUNT;
 	}
 	
Index: uspace/app/top/input.h
===================================================================
--- uspace/app/top/input.h	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/top/input.h	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -45,7 +45,9 @@
 #define TOP_INPUT_
 
+#include <sys/time.h>
+
 extern int rwait(struct timeval *);
-extern int tgetchar(void);
-extern void tsleep(void);
+extern int tgetchar(unsigned int sec);
+extern void tsleep(unsigned int sec);
 
 #endif
Index: uspace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/top/screen.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -38,8 +38,6 @@
 #include <io/console.h>
 #include <vfs/vfs.h>
-#include <futex.h>
 #include "screen.h"
-
-futex_t screen_lock;
+#include "top.h"
 
 static void resume_normal(void)
@@ -68,4 +66,28 @@
 }
 
+static inline void print_time(data_t *data)
+{
+	printf("%02d:%02d:%02d ", data->hours, data->minutes, data->seconds);
+}
+
+static inline void print_uptime(data_t *data)
+{
+	printf("up %4d days, %02d:%02d:%02d ", data->uptime_d, data->uptime_h,
+		data->uptime_m, data->uptime_s);
+}
+
+static int i = 0;
+void print_data(data_t *data)
+{
+	clear_screen();
+	fflush(stdout);
+	printf("top - ");
+	print_time(data);
+	print_uptime(data);
+	puts(" ... \n");
+	printf("A dalsi radek topu - jiz po %dte", ++i);
+	fflush(stdout);
+}
+
 /** @}
  */
Index: uspace/app/top/screen.h
===================================================================
--- uspace/app/top/screen.h	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/top/screen.h	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -34,11 +34,10 @@
 #define TOP_SCREEN_H_
 
-#include <futex.h>
-
-extern futex_t screen_lock;
+#include "top.h"
 
 extern void screen_init(void);
 extern void clear_screen(void);
 extern void moveto(int r, int c);
+extern void print_data(data_t *data);
 
 #endif
Index: uspace/app/top/top.c
===================================================================
--- uspace/app/top/top.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/top/top.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -37,24 +37,64 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <async.h>
 #include <unistd.h>
 #include <io/console.h>
-#include <vfs/vfs.h>
+#include <uptime.h>
+#include <task.h>
+#include <thread.h>
+#include <sys/time.h>
+#include <load.h>
 #include "screen.h"
 #include "input.h"
+#include "top.h"
+
+#define UPDATE_INTERVAL 1
+
+#define DAY 86400
+#define HOUR 3600
+#define MINUTE 60
+
+static void read_vars(data_t *target)
+{
+	/* Read current time */
+	struct timeval time;
+	if (gettimeofday(&time, NULL) != 0) {
+		printf("Cannot get time of day!\n");
+		exit(1);
+	}
+	target->hours = (time.tv_sec % DAY) / HOUR;
+	target->minutes = (time.tv_sec % HOUR) / MINUTE;
+	target->seconds = time.tv_sec % MINUTE;
+
+	/* Read uptime */
+	uint64_t uptime;
+	get_uptime(&uptime);
+	target->uptime_d = uptime / DAY;
+	target->uptime_h = (uptime % DAY) / HOUR;
+	target->uptime_m = (uptime % HOUR) / MINUTE;
+	target->uptime_s = uptime % MINUTE;
+
+	/* Read load */
+	get_load(target->load);
+}
 
 int main(int argc, char *argv[])
 {
+	data_t old_data;
+	data_t new_data;
+
+	/* Read initial stats */
+	printf("Reading initial data...\n");
+	read_vars(&old_data);
+	sleep(UPDATE_INTERVAL);
+	read_vars(&new_data);
+
 	screen_init();
 
 	/* And paint screen until death... */
-	int i = 0;
 	while (true) {
-		char c = tgetchar();
+		char c = tgetchar(UPDATE_INTERVAL);
 		if (c < 0) {
-			clear_screen();
-			moveto(0,0);
-			printf("Still running;-) for  %d...", i++);
-			fflush(stdout);
+			read_vars(&new_data);
+			print_data(&new_data);
 			continue;
 		}
@@ -68,6 +108,8 @@
 				break;
 		}
+
 	}
 
+	puts("\n\n");
 	fflush(stdout);
 	return 0;
Index: uspace/app/top/top.h
===================================================================
--- uspace/app/top/top.h	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
+++ uspace/app/top/top.h	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2008 Stanislav Kozina
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup top
+ * @{
+ */
+
+#ifndef TOP_TOP_H_
+#define TOP_TOP_H_
+
+typedef struct {
+	unsigned int hours;
+	unsigned int minutes;
+	unsigned int seconds;
+
+	unsigned int uptime_d;
+	unsigned int uptime_h;
+	unsigned int uptime_m;
+	unsigned int uptime_s;
+
+	unsigned long load[3];
+} data_t;
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/app/uptime/uptime.c
===================================================================
--- uspace/app/uptime/uptime.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/app/uptime/uptime.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -61,12 +61,17 @@
 	uint64_t uptime;
 	get_uptime(&uptime);
-	printf("\tUp %4llu days, %02llu:%02llu:%02llu",
+	printf(", up %4llu days, %02llu:%02llu:%02llu",
 		uptime / DAY, (uptime % DAY) / HOUR, (uptime % HOUR) / MINUTE, uptime % MINUTE);
 
-	size_t load[3];
+	unsigned long load[3];
 	get_load(load);
-	printf("\t load: %d.%03d %d.%03d %d.%03d ", ECHOLOAD1(load[0]), ECHOLOAD2(load[0]), ECHOLOAD1(load[1]), ECHOLOAD2(load[1]), ECHOLOAD1(load[2]), ECHOLOAD2(load[2]));
+	puts(", load avarage: ");
+	print_load_fragment(load[0], 2);
+	puts(" ");
+	print_load_fragment(load[1], 2);
+	puts(" ");
+	print_load_fragment(load[2], 2);
 
-	printf("\n");
+	puts("\n");
 	return 0;
 }
Index: uspace/lib/c/generic/load.c
===================================================================
--- uspace/lib/c/generic/load.c	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/lib/c/generic/load.c	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -35,4 +35,5 @@
 #include <load.h>
 #include <libc.h>
+#include <stdio.h>
 
 /** Get current system load
@@ -43,9 +44,23 @@
  *
  */
-int get_load(size_t *load)
+int get_load(unsigned long *load)
 {
 	return __SYSCALL1(SYS_PS_GET_LOAD, (sysarg_t) load);
 }
 
+void print_load_fragment(unsigned long upper, int dec_length)
+{
+	int i;
+	/* Magic value from BSD */
+	unsigned long lower = 65536;
+	/* Print whole part */
+	printf("%u.", upper / lower);
+	unsigned long rest = (upper % lower) * 10;
+	for (i = 0; i < dec_length; ++i) {
+		printf("%d", rest / lower);
+		rest = (rest % lower) * 10;
+	}
+}
+
 /** @}
  */
Index: uspace/lib/c/include/load.h
===================================================================
--- uspace/lib/c/include/load.h	(revision 83a957a3380b0543ed68df2553900081689ac546)
+++ uspace/lib/c/include/load.h	(revision 79edc36068b3e69b1d1719de0dc8332601090c30)
@@ -39,5 +39,6 @@
 #include <libarch/types.h>
 
-extern int get_load(size_t *load);
+extern int get_load(unsigned long *load);
+extern void print_load_fragment(unsigned long upper, int dec_length);
 
 #endif
