To get the system's uptime in seconds, you can read the first value from /proc/uptime.

# cat /proc/uptime
421679.97 841913.42

The first value is the system uptime in seconds. The second value is the amount of time the system has been idle. Notice that the idle time is greater than the actual uptime. This is because the time is the sum of all the cores on the system.

To get an integer from the value above, you could do something like:

#!/bin/sh

Uptime=$(</proc/uptime)
Uptime=${Uptime%%.*}

echo $Uptime