Check out the manpage on sysinfo. It gets you all kinds of information.
And try out this code:
int main (void)
struct sysinfo *info;
printf("Uptime = %d\n",info->uptime);
info->uptime is in seconds so you will have to do some math to figure out hours, minutes, days, ect.