xref: /third_party/musl/compat/time32/time32gm.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/compat/time32/
1570af302Sopenharmony_ci#define _GNU_SOURCE
2570af302Sopenharmony_ci#include "time32.h"
3570af302Sopenharmony_ci#include <time.h>
4570af302Sopenharmony_ci#include <errno.h>
5570af302Sopenharmony_ci#include <stdint.h>
6570af302Sopenharmony_ci
7570af302Sopenharmony_citime32_t __time32gm(struct tm *tm)
8570af302Sopenharmony_ci{
9570af302Sopenharmony_ci	time_t t = timegm(tm);
10570af302Sopenharmony_ci	if (t < INT32_MIN || t > INT32_MAX) {
11570af302Sopenharmony_ci		errno = EOVERFLOW;
12570af302Sopenharmony_ci		return -1;
13570af302Sopenharmony_ci	}
14570af302Sopenharmony_ci	return t;
15570af302Sopenharmony_ci}
16

Indexes created Thu Nov 07 10:32:03 CST 2024