aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r--src/microhttpd/connection.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 26bf6cc0..fd19e112 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -663,18 +663,37 @@ get_date_string (char *date)
663 }; 663 };
664 struct tm now; 664 struct tm now;
665 time_t t; 665 time_t t;
666#if defined(_WIN32) && !defined(HAVE_GMTIME_S) && !defined(__CYGWIN__)
667 struct tm* pNow;
668#endif
666 669
670 date[0] = 0;
667 time (&t); 671 time (&t);
668 gmtime_r (&t, &now); 672#if !defined(_WIN32)
669 SPRINTF (date, 673 if (NULL != gmtime_r (&t, &now))
670 "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", 674 {
671 days[now.tm_wday % 7], 675#elif defined(HAVE_GMTIME_S)
672 (unsigned int) now.tm_mday, 676 if (0 == gmtime_s (&now, &t))
673 mons[now.tm_mon % 12], 677 {
674 (unsigned int) (1900 + now.tm_year), 678#elif defined(__CYGWIN__)
675 (unsigned int) now.tm_hour, 679 if (NULL != gmtime_r (&t, &now))
676 (unsigned int) now.tm_min, 680 {
677 (unsigned int) now.tm_sec); 681#else
682 pNow = gmtime(&t);
683 if (NULL != pNow)
684 {
685 now = *pNow;
686#endif
687 sprintf (date,
688 "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n",
689 days[now.tm_wday % 7],
690 (unsigned int) now.tm_mday,
691 mons[now.tm_mon % 12],
692 (unsigned int) (1900 + now.tm_year),
693 (unsigned int) now.tm_hour,
694 (unsigned int) now.tm_min,
695 (unsigned int) now.tm_sec);
696 }
678} 697}
679 698
680 699