timegm.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
  2. Copyright (C) 1994, 1997, 2003-2004, 2006-2007, 2009-2015 Free Software
  3. Foundation, Inc. This file is part of the GNU C Library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _LIBC
  15. # include <config.h>
  16. #endif
  17. #include <time.h>
  18. #ifndef _LIBC
  19. # undef __gmtime_r
  20. # define __gmtime_r gmtime_r
  21. # define __mktime_internal mktime_internal
  22. # include "mktime-internal.h"
  23. #endif
  24. time_t
  25. timegm (struct tm *tmp)
  26. {
  27. static time_t gmtime_offset;
  28. tmp->tm_isdst = 0;
  29. return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
  30. }