[FreeBSD] Uptime in Unix-timestamp

Discussion in 'Linux & BSD' started by Glaanieboy, May 30, 2004.

  1. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Is there a utility in FreeBSD that allows you to see the systems uptime in Unix timestamp? I am asking this because I want an easier method of integrating the system's uptime in a PHP file. Unix timestamp makes life so much easier :)
     
  2. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  3. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Thanks. Now I have to wait for the motherboad of my server to come back so I can try it out :(
     
  4. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Oooh nice script, errr to bad it needs this thing called /proc/uptime that only Linux users have.

    # uptime.pl reads the system uptime in seconds since the Epoch from /proc/uptime and ...

    Well anyways, long story short, FreeBSD does not have a /proc/uptime.

    We have sysctl:

    Breached# sysctl -a | grep boottime
    kern.boottime: { sec = 1079091748, usec = 309886 } Fri Mar 12 06:42:28 2004

    sec is what time it was when it was booted.


    Check out the source for phpSysInfo if you want to know how to do it :)