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, 2010 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, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #ifndef _LIBC
  16. # include <config.h>
  17. #endif
  18. #include <time.h>
  19. #ifndef _LIBC
  20. # undef __gmtime_r
  21. # define __gmtime_r gmtime_r
  22. # define __mktime_internal mktime_internal
  23. # include "mktime-internal.h"
  24. #endif
  25. time_t
  26. timegm (struct tm *tmp)
  27. {
  28. static time_t gmtime_offset;
  29. tmp->tm_isdst = 0;
  30. return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
  31. }