Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shichao-an/6be4fa71d74422d28709 to your computer and use it in GitHub Desktop.
Save shichao-an/6be4fa71d74422d28709 to your computer and use it in GitHub Desktop.
#include <time.h>
struct tm *gmtime(const time_t *calptr);
struct tm *localtime(const time_t *calptr);
/* Both return: pointer to broken-down time, NULL on error */
#include <time.h>
time_t mktime(struct tm *tmptr);
Returns: calendar time if OK, −1 on error
#include <time.h>
size_t strftime(char *restrict buf, size_t maxsize,
const char *restrict format,
const struct tm *restrict tmptr);
size_t strftime_l(char *restrict buf, size_t maxsize,
const char *restrict format,
const struct tm *restrict tmptr, locale_t locale);
/* Both return: number of characters stored in array if room, 0 otherwise */
#include <time.h>
char *strptime(const char *restrict buf, const char *restrict format,
struct tm *restrict tmptr);
/* Returns: pointer to one character past last character parsed, NULL otherwise */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment