Guest User

Untitled

a guest
Apr 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include "../drivers.h"
  2. #include <stdio.h>
  3. #include <time.h>
  4.  
  5. PUBLIC void get_uptime(char *buf, int bufSize)
  6. {
  7. clock_t user_time, sys_time, uptime;
  8. int status, uptime_in_seconds;
  9. int proc_nr = PROC_PROC_NR; /* arbitrary, we aren't using the proc's times */
  10. status = sys_times(proc_nr, &user_time, &sys_time, &uptime);
  11. if (status != OK) printf("PROC: couldn't get uptime: %d",status);
  12.  
  13. uptime_in_seconds = uptime / CLOCKS_PER_SEC;
  14. sprintf(buf, "%d seconds since boot\n", uptime_in_seconds);
  15. }
Add Comment
Please, Sign In to add comment