~ubuntu-branches/ubuntu/saucy/curl/saucy-201307251546

« back to all changes in this revision

Viewing changes to lib/parsedate.c

  • Committer: Bazaar Package Importer
  • Author(s): Ramakrishnan Muthukrishnan
  • Date: 2011-02-28 19:35:36 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: james.westby@ubuntu.com-20110228193536-p3a9jawxxofcsz7o
Tags: upstream-7.21.4
ImportĀ upstreamĀ versionĀ 7.21.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
514
514
  /* everything else is fail */
515
515
  return -1;
516
516
}
 
517
 
 
518
/*
 
519
 * Curl_gmtime() is a gmtime() replacement for portability. Do not use the
 
520
 * gmtime_r() or gmtime() functions anywhere else but here.
 
521
 *
 
522
 * To make sure no such function calls slip in, we define them to cause build
 
523
 * errors, which is why we use the name within parentheses in this function.
 
524
 *
 
525
 */
 
526
 
 
527
CURLcode Curl_gmtime(time_t intime, struct tm *store)
 
528
{
 
529
  const struct tm *tm;
 
530
#ifdef HAVE_GMTIME_R
 
531
  /* thread-safe version */
 
532
  tm = (struct tm *)gmtime_r(&intime, store);
 
533
#else
 
534
  tm = gmtime(&intime);
 
535
  if(tm)
 
536
    *store = *tm; /* copy the pointed struct to the local copy */
 
537
#endif
 
538
 
 
539
  if(!tm)
 
540
    return CURLE_BAD_FUNCTION_ARGUMENT;
 
541
  return CURLE_OK;
 
542
}