Don't click here unless you want to be banned.

LSL Wiki : llGetGMTclock

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
float llGetGMTclock()

Gets the time in seconds since midnight in GMT/UTC.

GMT time is very useful when synchronizing with systems outside of SL via email or RPC. It is an absolute and international measure of time that does not change throughout the year. It isn't so great when trying to make a wall clock for Second Life that observes Daylight Saving Time. Creating local time from this function is a matter of adding the correct offset to GMT, a requirement complicated by yearly and national differences of when Daylight Saving Time goes into and out of effect.

The following function gets a clock for any time zone in the world, with a military time toggle.
(by DanielLuchador)
(note by CeeqLaborde - I actually think this breaks bad when timezone takes the gmt time over 23:59:59)

string clock(float timezone, integer military)
{
    integer raw = (integer)(llGetGMTclock() + (timezone * 3600));
    integer shiftraw = raw;

      //  3600 = seconds in an hour
      // 86400 = seconds in 24 hours
    if((timezone * 3600) + raw > 86400)
    {
        shiftraw = raw - 86400;
    }
    else if((timezone * 3600) + raw < 0)
    {
        shiftraw = raw + 86400;
    }
    
    integer hours = shiftraw / 3600;
    integer minutes = (shiftraw % 3600) / 60;
    integer seconds = shiftraw % 60;
    string ampm;
    
    //non-military time adjustments
    if(!military)
    {
          // 43200 = seconds in 12 hours
        if(shiftraw < 43200)
        {
            ampm = " AM";
        }
        else
        {
            ampm = " PM";
            hours -= 12;
        }
    }
    
    string shours = (string)hours;
    string sminutes = (string)minutes;
    string sseconds = (string)seconds;
    
    //add zeros to single digit minutes/seconds
    if(llStringLength(sminutes) == 1)
    {
        sminutes = "0" + sminutes;
    }
    if(llStringLength(sseconds) == 1)
    {
        sseconds = "0" + sseconds;
    }
    
    string time = shours + ":" + sminutes + ":" + sseconds + ampm;
    
    return time;
}

For a monotonic time source with seconds precision use llGetUnixTime

See also: llGetWallclock (returns time in seconds in the PST/PDT time zone).


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Time | Simulator Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
There are 3 comments on this page. [Display comments/form]