Coder Social home page Coder Social logo

gmtime's Introduction

GMT Timezone plugin

This is timezone plugin. You can set any timezone for your SA-MP server. And some useful function.

Important

This plugin was originally created by Fro1sha. I added the plugin to GitHub as the SA-MP forum is no longer available forever.


Natives

native gm_SetTimeZone(hour = 0, minute = 0);
native gm_gettime(&hour = 0, &minute = 0, &second = 0);
native gm_getdate(&year=0, &month = 0, &day = 0, &wday = 0);

native gm_strftime(const string[], dest[], size = sizeof(dest));
native gm_timestamp();
native gm_mktime(hour, minute, second, year, month, day);
native gm_timestamp_to_date(timestamp, &hour = 0, &minute = 0, &second = 0, &year = 0, &month = 0, &day = 0);

native gm_GetMonthDay(month, year = 1990);
native gm_ConvertSeconds(time, &hour = 0, &minute = 0, &second = 0, &year = 0, &month = 0, &day = 0);

How to use

// Auto replacement default pawn time function
#define AUTO_SETUP
#include <gmtime>

Small example

#define AUTO_SETUP
#include <gmtime>
 
main
{
    // Set timezone to +0
    SetTimeZone( 0 );
    
    new
        hour, minute, second,
        year, month, day, 
        wday // week day 0-6
    ;
    
    printf( "Cur TimeStamp(gettime) %d", gettime( hour, minute, second ) );
    printf( "Hour: %d Minute: %d Seconds: %d", hour, minute, second );
    
    printf( "Day(getdate) %d", getdate( year, month, day, wday ) );
    printf( "Year: %d Month: %d Day: %d WeekDay: %d", year, month, day, wday );
    
    new
        buffer[ 80 ]
    ;
    
    // More details:
    // http://www.cplusplus.com/reference/clibrary/ctime/strftime/
    strftime( "Now it's %I:%M%p.", buffer ); 
    print( buffer );
    
    // TimeStamp time
    printf( "Cur TimeStamp(timestamp) %d", timestamp(  ) );
    
    // Converting date and time in TimeStamp
    printf( "mktime: %d", mktime( hour, minute, second, year, month, day ) );
    
    // Converting TimeStamp in date and time
    timestamp_to_date( timestamp(  ), hour, minute, second, year, month, day );
    print( "timestamp_to_date:" );
    printf( "Hour: %d Minute: %d Seconds: %d", hour, minute, second );
    printf( "Year: %d Month: %d Day: %d", year, month, day );
    
    // Return the number of days in that month
    printf( "Month(%d) Days: %d", month, GetMonthDay( month, year ) );
    
    // Converting seconds in date and time
    ConvertSeconds( 65486, hour, minute, second, year, month, day );
    print( "ConvertSeconds:" );
    printf( "Hour: %d Minute: %d Seconds: %d", hour, minute, second );
    printf( "Year: %d Month: %d Day: %d", year, month, day );
}

gmtime's People

Contributors

0xwhyd avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

patryk110200

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.