samp.directory
← Scripts and libraries

ScavengeSurvive/timeutil

A collection of assorted utilities for working with timestamps and time values. Uses CTime and sscanf.

Library★ 1updated Jan 2018MITPAWNsampctl
Open on GitHub

Install with sampctl

sampctl package install ScavengeSurvive/timeutil

Run this in your project folder. sampctl downloads the package and what it depends on.

Depends on 3 packages

Used by 1 package

README.md

timeutil.inc

A collection of assorted utilities for working with timestamps and time values. Uses CTime and sscanf.

  • RoundTimestamp(timestamp, roundamount) Rounds a timestamp down to a certain unit:
    • ROUND_TYPE_MINUTE
    • ROUND_TYPE_HOUR
    • ROUND_TYPE_DAY
  • TimestampToDateTime(datetime, format[] = CTIME_DATE_TIME) Simple wrapper around ctime to format a timestamp.
  • MsToString(millisecond, format[]) strftime but for millisecond durations.
  • GetDurationFromString(string[]) Returns a duration from a user-supplied string such as "3 days" or "9 minutes".

Usage

Simply add to your pawn.json and include:

{
    "dependencies": ["ScavengeSurvive/timeutil"]
}
#include <timeutil>

Testing

To test, simply run the package:

sampctl package run

This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing