diff --git a/src/xpdev/datewrap.c b/src/xpdev/datewrap.c
index 34eb53e25d86e4427d02367bab094782eadff377..82c07e338c0ce48f0f4d1904a34ccd9235c5f3a7 100644
--- a/src/xpdev/datewrap.c
+++ b/src/xpdev/datewrap.c
@@ -35,9 +35,46 @@
  * Note: If this box doesn't appear square, then you need to fix your tabs.	*
  ****************************************************************************/
 
-#if !defined(__BORLANDC__)
+#include "genwrap.h"
+
+/* Decimal-coded date functions */
+long time_to_date(time_t time)
+{
+	struct tm tm;
+
+	if(time==0)
+		return(0);
+
+	ZERO_VAR(tm);
+	if(gmtime_r(&time,&tm)==NULL)
+		return(0);
+	return(((tm.tm_year+1900)*10000)+((tm.tm_mon+1)*100)+tm.tm_mday);
+}
+
+time_t date_to_time(long date)
+{
+	struct tm tm;
 
-#include <time.h>	/* time(), time_t, struct tm, localtime() */
+	ZERO_VAR(tm);
+
+	if(date==0)
+		return(0);
+
+	tm.tm_year=date/10000;
+	tm.tm_mon=(date/100)%100;
+	tm.tm_mday=date%100;
+
+	/* correct for tm-wierdness */
+	if(tm.tm_year>=1900)
+		tm.tm_year-=1900;
+	if(tm.tm_mon)
+		tm.tm_mon--;
+	tm.tm_isdst=-1;	/* Auto-adjust for DST */
+
+	return(mktime(&tm));
+}
+
+#if !defined(__BORLANDC__)
 
 #if defined(_WIN32)
 	#include <windows.h>	/* SYSTEMTIME and GetLocalTime() */
diff --git a/src/xpdev/datewrap.h b/src/xpdev/datewrap.h
index ccb9b046f695db13a6397c67d43145edb744cfec..5b68a865dc2b2803c801081a1eb338f79c391c4b 100644
--- a/src/xpdev/datewrap.h
+++ b/src/xpdev/datewrap.h
@@ -38,6 +38,12 @@
 #ifndef _DATEWRAP_H_
 #define _DATEWRAP_H_
 
+#include "genwrap.h"	/* time_t */
+
+/* Decimal-coded date functions */
+long	time_to_date(time_t time);
+time_t	date_to_time(long date);
+
 #if defined(__BORLANDC__)
 
 #include <dos.h>