Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../drivers.h"
- #include <stdio.h>
- #include <time.h>
- PUBLIC void get_uptime(char *buf, int bufSize)
- {
- clock_t user_time, sys_time, uptime;
- int status, uptime_in_seconds;
- int proc_nr = PROC_PROC_NR; /* arbitrary, we aren't using the proc's times */
- status = sys_times(proc_nr, &user_time, &sys_time, &uptime);
- if (status != OK) printf("PROC: couldn't get uptime: %d",status);
- uptime_in_seconds = uptime / CLOCKS_PER_SEC;
- sprintf(buf, "%d seconds since boot\n", uptime_in_seconds);
- }
Add Comment
Please, Sign In to add comment