Skip to content

Conversation

sirdigbot
Copy link
Contributor

@sirdigbot sirdigbot commented Aug 11, 2022

Resolves #875

Tested with the following code and https://www.epochconverter.com/

#include <sourcemod>

public void OnPluginStart()
{
    char time[32];
    
    PrintToServer("Now: %i", GetTime());
    
    FormatTime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", 0);
    PrintToServer("Local time 0: %s", time);
    
    FormatTime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", 0, false); 
    PrintToServer("UTC time 0: %s", time);
    
    FormatTime(time, sizeof(time), "%Y-%m-%d %H:%M:%S");
    PrintToServer("Local time now: %s", time);
    
    FormatTime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", -1, false);
    PrintToServer("UTC time now: %s", time);

    // OUTPUTS:
    // Now: 1660197444
    // Local time 0: 1970-01-01 11:00:00
    // UTC time 0: 1970-01-01 00:00:00
    // Local time now: 2022-08-11 15:57:24
    // UTC time now: 2022-08-11 05:57:24
}

@sirdigbot
Copy link
Contributor Author

I never saw it because I guess it wasn't linked to the issue, but PR #917 addresses the same thing

@sapphonie
Copy link
Contributor

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: FormatTime() and time correcting
3 participants