diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/dcmrecv.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/dcmrecv.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/dcmrecv.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/dcmrecv.cc	2017-12-18 09:53:14.249431248 +0100
@@ -266,8 +266,8 @@
     storageSCP.setPort(OFstatic_cast(Uint16, opt_port));
     storageSCP.setAETitle(opt_aeTitle);
     storageSCP.setMaxReceivePDULength(OFstatic_cast(Uint32, opt_maxPDULength));
-    storageSCP.setACSETimeout(OFstatic_cast(Uint32, opt_acseTimeout));
-    storageSCP.setDIMSETimeout(OFstatic_cast(Uint32, opt_dimseTimeout));
+    storageSCP.setACSETimeout(OFstatic_cast(OFTimeValue, opt_acseTimeout));
+    storageSCP.setDIMSETimeout(OFstatic_cast(OFTimeValue, opt_dimseTimeout));
     storageSCP.setDIMSEBlockingMode(opt_blockingMode);
     storageSCP.setVerbosePCMode(opt_showPresentationContexts);
     storageSCP.setRespondWithCalledAETitle(opt_useCalledAETitle);
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/dcmsend.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/dcmsend.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/dcmsend.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/dcmsend.cc	2017-12-18 09:54:14.868150653 +0100
@@ -334,7 +334,7 @@
         if (cmd.findOption("--timeout"))
         {
             app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-            dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+            dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
         }
         if (cmd.findOption("--acse-timeout"))
             app.checkValue(cmd.getValueAndCheckMin(opt_acseTimeout, 1));
@@ -460,8 +460,8 @@
     storageSCU.setPeerAETitle(opt_peerTitle);
     storageSCU.setAETitle(opt_ourTitle);
     storageSCU.setMaxReceivePDULength(OFstatic_cast(Uint32, opt_maxReceivePDULength));
-    storageSCU.setACSETimeout(OFstatic_cast(Uint32, opt_acseTimeout));
-    storageSCU.setDIMSETimeout(OFstatic_cast(Uint32, opt_dimseTimeout));
+    storageSCU.setACSETimeout(OFstatic_cast(OFTimeValue, opt_acseTimeout));
+    storageSCU.setDIMSETimeout(OFstatic_cast(OFTimeValue, opt_dimseTimeout));
     storageSCU.setDIMSEBlockingMode(opt_blockMode);
     storageSCU.setVerbosePCMode(opt_showPresentationContexts);
     storageSCU.setDatasetConversionMode(opt_decompressionMode != DcmStorageSCU::DM_never);
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/echoscu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/echoscu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/echoscu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/echoscu.cc	2017-12-18 09:54:31.175896880 +0100
@@ -61,7 +61,7 @@
 #define PEERAPPLICATIONTITLE "ANY-SCP"
 
 static T_DIMSE_BlockingMode opt_blockMode = DIMSE_BLOCKING;
-static int opt_dimse_timeout = 0;
+static OFTimeValue opt_dimse_timeout = 0;
 
 static OFCondition cecho(T_ASC_Association * assoc, unsigned long num_repeat);
 
@@ -126,7 +126,7 @@
     OFCmdUnsignedInt opt_numPresentationCtx  = 1;
     OFCmdUnsignedInt maxXferSyntaxes         = OFstatic_cast(OFCmdUnsignedInt, (DIM_OF(transferSyntaxes)));
     OFBool           opt_secureConnection    = OFFalse; /* default: no secure connection */
-    int opt_acse_timeout = 30;
+    OFTimeValue      opt_acse_timeout = 30;
 
 #ifdef WITH_OPENSSL
     int         opt_keyFileFormat = SSL_FILETYPE_PEM;
@@ -282,21 +282,21 @@
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+        dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
       }
 
       if (cmd.findOption("--acse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       }
 
       if (cmd.findOption("--dimse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
         opt_blockMode = DIMSE_NONBLOCKING;
       }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/findscu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/findscu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/findscu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/findscu.cc	2017-12-18 09:54:01.209000200 +0100
@@ -56,10 +56,10 @@
     OFList<OFString>      fileNameList;
     OFBool                opt_abortAssociation = OFFalse;
     const char *          opt_abstractSyntax = UID_FINDModalityWorklistInformationModel;
-    int                   opt_acse_timeout = 30;
+    OFTimeValue           opt_acse_timeout = 30;
     T_DIMSE_BlockingMode  opt_blockMode = DIMSE_BLOCKING;
     OFCmdSignedInt        opt_cancelAfterNResponses = -1;
-    int                   opt_dimse_timeout = 0;
+    OFTimeValue           opt_dimse_timeout = 0;
     int                   opt_outputResponsesToLogger = 0;
     OFBool                opt_extractResponsesToFile = OFFalse;
     OFString              opt_outputDirectory = ".";
@@ -301,21 +301,21 @@
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+        dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
       }
 
       if (cmd.findOption("--acse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       }
 
       if (cmd.findOption("--dimse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
         opt_blockMode = DIMSE_NONBLOCKING;
       }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/getscu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/getscu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/getscu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/getscu.cc	2017-12-18 09:54:21.251657301 +0100
@@ -64,8 +64,8 @@
 OFCmdUnsignedInt        opt_repeatCount = 1;
 QueryModel              opt_queryModel = QMPatientRoot;
 T_DIMSE_BlockingMode    opt_blockMode = DIMSE_BLOCKING;
-int                     opt_dimse_timeout = 0;
-int                     opt_acse_timeout = 30;
+OFCmdSignedInt          opt_dimse_timeout = 0;
+OFCmdSignedInt          opt_acse_timeout = 30;
 OFString                opt_outputDirectory = ".";
 static OFList<OFString> overrideKeys;
 
@@ -269,21 +269,21 @@
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+      dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
     }
 
     if (cmd.findOption("--acse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
     }
 
     if (cmd.findOption("--dimse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       opt_blockMode = DIMSE_NONBLOCKING;
     }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/movescu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/movescu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/movescu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/movescu.cc	2017-12-18 10:02:34.733733643 +0100
@@ -118,8 +118,8 @@
 OFCmdSignedInt    opt_cancelAfterNResponses = -1;
 QueryModel        opt_queryModel = QMPatientRoot;
 T_DIMSE_BlockingMode opt_blockMode = DIMSE_BLOCKING;
-int               opt_dimse_timeout = 0;
-int               opt_acse_timeout = 30;
+OFTimeValue       opt_dimse_timeout = 0;
+OFTimeValue       opt_acse_timeout = 30;
 OFBool            opt_ignorePendingDatasets = OFTrue;
 OFString          opt_outputDirectory = ".";
 int               cmove_status_code = EXITCODE_NO_ERROR;
@@ -493,21 +493,21 @@
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+        dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
       }
 
       if (cmd.findOption("--acse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       }
 
       if (cmd.findOption("--dimse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
         opt_blockMode = DIMSE_NONBLOCKING;
       }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/storescp.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/storescp.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/storescp.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/storescp.cc	2017-12-18 10:43:27.431961396 +0100
@@ -169,14 +169,14 @@
 
 OFString           lastStudySubdirectoryPathAndName;
 static OFBool      opt_renameOnEndOfStudy = OFFalse;  // default: don't rename any files on end of study
-static long        opt_endOfStudyTimeout = -1;        // default: no end of study timeout
+static OFTimeValue opt_endOfStudyTimeout = -1;        // default: no end of study timeout
 static OFBool      endOfStudyThroughTimeoutEvent = OFFalse;
 static const char *opt_configFile = NULL;
 static const char *opt_profileName = NULL;
 T_DIMSE_BlockingMode opt_blockMode = DIMSE_BLOCKING;
-int                opt_dimse_timeout = 0;
-int                opt_acse_timeout = 30;
-OFCmdSignedInt     opt_socket_timeout = 60;
+OFTimeValue        opt_dimse_timeout = 0;
+OFTimeValue        opt_acse_timeout = 30;
+OFTimeValue        opt_socket_timeout = 60;
 
 #if defined(HAVE_FORK) || defined(_WIN32)
 OFBool             opt_forkMode = OFFalse;
@@ -562,22 +562,26 @@
     if (opt_networkTransferSyntax != EXS_Unknown) opt_acceptAllXfers = OFFalse;
 
     if (cmd.findOption("--socket-timeout"))
-      app.checkValue(cmd.getValueAndCheckMin(opt_socket_timeout, -1));
+    {
+      OFCmdSignedInt opt_timeout = 0;
+      app.checkValue(cmd.getValueAndCheckMin(opt_timeout, -1));
+      opt_socket_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
+    }
     // always set the timeout values since the global default might be different
-    dcmSocketSendTimeout.set(OFstatic_cast(Sint32, opt_socket_timeout));
-    dcmSocketReceiveTimeout.set(OFstatic_cast(Sint32, opt_socket_timeout));
+    dcmSocketSendTimeout.set(OFstatic_cast(OFTimeValue, opt_socket_timeout));
+    dcmSocketReceiveTimeout.set(OFstatic_cast(OFTimeValue, opt_socket_timeout));
 
     if (cmd.findOption("--acse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
     }
     if (cmd.findOption("--dimse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       opt_blockMode = DIMSE_NONBLOCKING;
     }
 
@@ -895,9 +899,11 @@
 
     if (cmd.findOption("--eostudy-timeout"))
     {
+      OFCmdSignedInt opt_timeout = -1;
       app.checkDependence("--eostudy-timeout", "--sort-conc-studies, --sort-on-study-uid, --sort-on-patientname, --exec-on-eostudy or --rename-on-eostudy",
         (opt_sortStudyMode != ESM_None) || (opt_execOnEndOfStudy != NULL) || opt_renameOnEndOfStudy);
-      app.checkValue(cmd.getValueAndCheckMin(opt_endOfStudyTimeout, 0));
+      app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 0));
+      opt_endOfStudyTimeout = OFstatic_cast(OFTimeValue, opt_timeout);
     }
 
     if (cmd.findOption("--exec-sync")) opt_execSync = OFTrue;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/storescu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/storescu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/apps/storescu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/apps/storescu.cc	2017-12-18 09:52:48.410514654 +0100
@@ -119,9 +119,9 @@
 static const char *opt_configFile = NULL;
 static const char *opt_profileName = NULL;
 T_DIMSE_BlockingMode opt_blockMode = DIMSE_BLOCKING;
-int opt_dimse_timeout = 0;
-int opt_acse_timeout = 30;
-OFCmdSignedInt opt_socket_timeout = 60;
+OFTimeValue opt_dimse_timeout = 0;
+OFTimeValue opt_acse_timeout = 30;
+OFTimeValue opt_socket_timeout = 60;
 
 #ifdef WITH_ZLIB
 static OFCmdUnsignedInt opt_compressionLevel = 0;
@@ -498,27 +498,31 @@
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+        dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
       }
 
       if (cmd.findOption("--socket-timeout"))
-        app.checkValue(cmd.getValueAndCheckMin(opt_socket_timeout, -1));
+      {
+        OFCmdSignedInt opt_timeout = 0;
+        app.checkValue(cmd.getValueAndCheckMin(opt_timeout, -1));
+        opt_socket_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
+      }
       // always set the timeout values since the global default might be different
-      dcmSocketSendTimeout.set(OFstatic_cast(Sint32, opt_socket_timeout));
-      dcmSocketReceiveTimeout.set(OFstatic_cast(Sint32, opt_socket_timeout));
+      dcmSocketSendTimeout.set(OFstatic_cast(OFTimeValue, opt_socket_timeout));
+      dcmSocketReceiveTimeout.set(OFstatic_cast(OFTimeValue, opt_socket_timeout));
 
       if (cmd.findOption("--acse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       }
 
       if (cmd.findOption("--dimse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+        opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
         opt_blockMode = DIMSE_NONBLOCKING;
       }
 
@@ -1307,8 +1311,8 @@
 static int
 secondsSince1970()
 {
-  time_t t = time(NULL);
-  return OFstatic_cast(int, t);
+  OFTimeValue t = time(NULL);
+  return OFstatic_cast(OFTimeValue, t);
 }
 
 static OFString
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/assoc.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/assoc.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/assoc.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/assoc.h	2017-12-18 10:01:06.739834102 +0100
@@ -267,7 +267,7 @@
 DCMTK_DCMNET_EXPORT OFCondition ASC_initializeNetwork(
     T_ASC_NetworkRole role,
     int acceptorPort,
-    int timeout,
+    OFTimeValue timeout,
     T_ASC_Network ** network,
     unsigned long options = 0);
 
@@ -540,15 +540,15 @@
  */
 
 DCMTK_DCMNET_EXPORT OFBool
-ASC_associationWaiting(T_ASC_Network * network, int timeout);
+ASC_associationWaiting(T_ASC_Network * network, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFBool
-ASC_dataWaiting(T_ASC_Association * association, int timeout);
+ASC_dataWaiting(T_ASC_Association * association, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFBool
 ASC_selectReadableAssociation(
     T_ASC_Association* assocs[],
-    int assocCount, int timeout);
+    int assocCount, OFTimeValue timeout);
 
 /*
  * Association Messages
@@ -562,7 +562,7 @@
     void **associatePDU=NULL,
     unsigned long *associatePDUlength=NULL,
     DUL_BLOCKOPTIONS block=DUL_BLOCK,
-    int timeout=0);
+    OFTimeValue timeout=0);
 
 DCMTK_DCMNET_EXPORT OFCondition
 ASC_receiveAssociation(
@@ -573,7 +573,7 @@
     unsigned long *associatePDUlength=NULL,
     OFBool useSecureLayer=OFFalse,
     DUL_BLOCKOPTIONS block=DUL_BLOCK,
-    int timeout=0);
+    OFTimeValue timeout=0);
 
 DCMTK_DCMNET_EXPORT OFCondition
 ASC_acknowledgeAssociation(
@@ -598,7 +598,7 @@
 ASC_abortAssociation(T_ASC_Association * association);
 
 DCMTK_DCMNET_EXPORT OFCondition
-ASC_dropSCPAssociation(T_ASC_Association * association, int timeout = DUL_TIMEOUT);
+ASC_dropSCPAssociation(T_ASC_Association * association, OFTimeValue timeout = DUL_TIMEOUT);
 
 DCMTK_DCMNET_EXPORT OFCondition
 ASC_dropAssociation(T_ASC_Association * association);
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dcmtrans.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dcmtrans.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dcmtrans.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dcmtrans.h	2017-12-18 09:59:42.311584772 +0100
@@ -41,7 +41,7 @@
  *  disables the call of the corresponding setsockopt() function, so that the
  *  system's default behavior remains unchanged.
  */
-extern DCMTK_DCMNET_EXPORT OFGlobal<Sint32> dcmSocketSendTimeout;   /* default: 60 */
+extern DCMTK_DCMNET_EXPORT OFGlobal<OFTimeValue> dcmSocketSendTimeout;   /* default: 60 */
 
 /** Global timeout in seconds for receiving data on a socket from a remote host.
  *  The default value is 60, which is useful in cases where the receiver (e.g.
@@ -51,7 +51,7 @@
  *  disables the call of the corresponding setsockopt() function, so that the
  *  system's default behavior remains unchanged.
  */
-extern DCMTK_DCMNET_EXPORT OFGlobal<Sint32> dcmSocketReceiveTimeout;   /* default: 60 */
+extern DCMTK_DCMNET_EXPORT OFGlobal<OFTimeValue> dcmSocketReceiveTimeout;   /* default: 60 */
 
 /** this class represents a TCP/IP based transport connection
  *  which can be a transparent TCP/IP socket communication or a
@@ -137,7 +137,7 @@
    *     If this parameter is 0, the function does not block.
    *  @returns OFTrue if data is available, OFFalse otherwise.
    */
-  virtual OFBool networkDataAvailable(int timeout) = 0;
+  virtual OFBool networkDataAvailable(OFTimeValue timeout) = 0;
 
   /** returns OFTrue if this connection is a transparent TCP connection,
    *  OFFalse if the connection is a secure connection.
@@ -177,7 +177,7 @@
    *  @return OFTrue if one or more connections are readable upon return from
    *    this method, OFFalse if no connection is ready for reading.
    */
-  static OFBool selectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
+  static OFBool selectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout);
 
 protected:
 
@@ -215,7 +215,7 @@
    *  @return OFTrue if one or more connections are readable upon return from
    *    this method, OFFalse if no connection is ready for reading.
    */
-  static OFBool safeSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
+  static OFBool safeSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout);
 
   /** indicates which of the specified transport connections is ready for
    *  reading. If none of the specified transport connections is ready
@@ -233,7 +233,7 @@
    *  @return OFTrue if one or more connections are readable upon return from
    *    this method, OFFalse if no connection is ready for reading.
    */
-  static OFBool fastSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout);
+  static OFBool fastSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout);
 
   /// the socket file descriptor/handle used by the transport connection.
   DcmNativeSocketType theSocket;
@@ -321,7 +321,7 @@
    *     If this parameter is 0, the function does not block.
    *  @returns OFTrue if data is available, OFFalse otherwise.
    */
-  virtual OFBool networkDataAvailable(int timeout);
+  virtual OFBool networkDataAvailable(OFTimeValue timeout);
 
   /** returns OFTrue if this connection is a transparent TCP connection,
    *  OFFalse if the connection is a secure connection.
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dfindscu.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dfindscu.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dfindscu.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dfindscu.h	2017-12-18 09:59:24.521476478 +0100
@@ -168,7 +168,7 @@
    *  @param acse_timeout timeout for ACSE operations, in seconds
    *  @return EC_Normal if successful, an error code otherwise
    */
-  OFCondition initializeNetwork(int acse_timeout);
+  OFCondition initializeNetwork(OFTimeValue acse_timeout);
 
   /** enable user-defined transport layer. This method is needed when
    *  the network association should use a non-default transport layer
@@ -237,7 +237,7 @@
     const char *abstractSyntax,
     E_TransferSyntax preferredTransferSyntax,
     T_DIMSE_BlockingMode blockMode,
-    int dimse_timeout,
+    OFTimeValue dimse_timeout,
     Uint32 maxReceivePDULength,
     OFBool secureConnection,
     OFBool abortAssociation,
@@ -304,7 +304,7 @@
     int repeatCount,
     const char *abstractSyntax,
     T_DIMSE_BlockingMode blockMode,
-    int dimse_timeout,
+    OFTimeValue dimse_timeout,
     OFBool extractResponsesToFile,
     int cancelAfterNResponses,
     OFList<OFString> *overrideKeys,
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dimse.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dimse.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dimse.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dimse.h	2017-12-18 09:59:55.810650112 +0100
@@ -662,7 +662,7 @@
         /* in */
         T_ASC_Association *assoc, DIC_US msgId,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* out */
         DIC_US *status, DcmDataset **statusDetail);
 
@@ -710,7 +710,7 @@
         const char *imageFileName, DcmDataset *imageDataSet,
         DIMSE_StoreUserCallback callback, void *callbackData,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* out */
         T_DIMSE_C_StoreRSP *response,
         DcmDataset **statusDetail,
@@ -738,7 +738,7 @@
     DcmDataset **imageDataSet,
         DIMSE_StoreProviderCallback callback, void *callbackData,
         /* blocking info for data set */
-        T_DIMSE_BlockingMode blockMode, int timeout);
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_sendStoreResponse(T_ASC_Association * assoc,
@@ -769,7 +769,7 @@
         T_DIMSE_C_FindRQ *request, DcmDataset *requestIdentifiers,
         DIMSE_FindUserCallback callback, void *callbackData,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* out */
         T_DIMSE_C_FindRSP *response, DcmDataset **statusDetail);
 
@@ -791,7 +791,7 @@
         T_DIMSE_C_FindRQ *request,
         DIMSE_FindProviderCallback callback, void *callbackData,
         /* blocking info for data set */
-        T_DIMSE_BlockingMode blockMode, int timeout);
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_sendFindResponse(T_ASC_Association * assoc,
@@ -822,7 +822,7 @@
         DcmDataset *requestIdentifiers,
         DIMSE_MoveUserCallback callback, void *callbackData,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* sub-operation provider callback */
         T_ASC_Network *net,
         DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData,
@@ -848,7 +848,7 @@
         T_DIMSE_C_MoveRQ *request,
         DIMSE_MoveProviderCallback callback, void *callbackData,
         /* blocking info for data set */
-        T_DIMSE_BlockingMode blockMode, int timeout);
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_sendMoveResponse(T_ASC_Association * assoc,
@@ -878,7 +878,7 @@
         DcmDataset *requestIdentifiers,
         DIMSE_GetUserCallback callback, void *callbackData,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* sub-operation provider callback */
         T_ASC_Network *net,
         DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData,
@@ -903,7 +903,7 @@
         T_DIMSE_C_GetRQ *request,
         DIMSE_GetProviderCallback callback, void *callbackData,
         /* blocking info for data set */
-        T_DIMSE_BlockingMode blockMode, int timeout);
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_sendGetResponse(T_ASC_Association * assoc,
@@ -962,7 +962,7 @@
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_receiveCommand(T_ASC_Association *association,
                      T_DIMSE_BlockingMode blocking,
-                     int timeout,
+                     OFTimeValue timeout,
                      T_ASC_PresentationContextID *presID,
                      T_DIMSE_Message *msg,
                      DcmDataset **statusDetail,
@@ -971,7 +971,7 @@
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_receiveDataSetInMemory(T_ASC_Association *association,
                      T_DIMSE_BlockingMode blocking,
-                     int timeout,
+                     OFTimeValue timeout,
                      T_ASC_PresentationContextID *presID,
                      DcmDataset **dataObject,
                      DIMSE_ProgressCallback callback,
@@ -990,7 +990,7 @@
 
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_receiveDataSetInFile(T_ASC_Association *assoc,
-                     T_DIMSE_BlockingMode blocking, int timeout,
+                     T_DIMSE_BlockingMode blocking, OFTimeValue timeout,
                      T_ASC_PresentationContextID *presID,
                      DcmOutputStream *filestream,
                      DIMSE_ProgressCallback callback, void *callbackData);
@@ -998,7 +998,7 @@
 DCMTK_DCMNET_EXPORT OFCondition
 DIMSE_ignoreDataSet( T_ASC_Association * assoc,
                      T_DIMSE_BlockingMode blocking,
-                     int timeout,
+                     OFTimeValue timeout,
                      DIC_UL * bytesRead,
                      DIC_UL * pdvCount);
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dul.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dul.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/dul.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/dul.h	2017-12-18 10:01:41.378579710 +0100
@@ -88,7 +88,7 @@
 /** Global timeout in seconds for connecting to remote hosts.
  *  Default value is -1, which selects infinite timeout, i.e. blocking connect().
  */
-extern DCMTK_DCMNET_EXPORT OFGlobal<Sint32> dcmConnectionTimeout;   /* default: -1 */
+extern DCMTK_DCMNET_EXPORT OFGlobal<OFTimeValue> dcmConnectionTimeout;   /* default: -1 */
 
 /** This global flag allows to set an already opened socket file descriptor which
  *  will be used by dcmnet the next time receiveTransportConnectionTCP() is called.
@@ -402,7 +402,7 @@
 DUL_InitializeNetwork(
   const char *mode,
   void *param,
-  int timeout,
+  OFTimeValue timeout,
   unsigned long
   options,
   DUL_NETWORKKEY ** network);
@@ -411,7 +411,7 @@
 DUL_ReceiveAssociationRQ(
   DUL_NETWORKKEY ** network,
   DUL_BLOCKOPTIONS block,
-  int timeout,
+  OFTimeValue timeout,
   DUL_ASSOCIATESERVICEPARAMETERS * parameters,
   DUL_ASSOCIATIONKEY ** association,
   int activatePDUStorage);
@@ -426,7 +426,7 @@
 DUL_RequestAssociation(
   DUL_NETWORKKEY ** network,
   DUL_BLOCKOPTIONS block,
-  int timeout,
+  OFTimeValue timeout,
   DUL_ASSOCIATESERVICEPARAMETERS * params,
   DUL_ASSOCIATIONKEY ** association,
   int activatePDUStorage);
@@ -443,7 +443,7 @@
 */
 DCMTK_DCMNET_EXPORT OFCondition
 DUL_ReadPDVs(DUL_ASSOCIATIONKEY ** association,
-       DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, int timeout);
+       DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, OFTimeValue timeout);
 DCMTK_DCMNET_EXPORT OFCondition
 DUL_WritePDVs(DUL_ASSOCIATIONKEY ** association,
         DUL_PDVLIST * pdvList);
@@ -474,12 +474,12 @@
 */
 
 DCMTK_DCMNET_EXPORT OFBool
-DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, int timeout);
+DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, OFTimeValue timeout);
 
 DCMTK_DCMNET_EXPORT DcmNativeSocketType DUL_networkSocket(DUL_NETWORKKEY * callerNet);
 
 DCMTK_DCMNET_EXPORT OFBool
-DUL_associationWaiting(DUL_NETWORKKEY * callerNet, int timeout);
+DUL_associationWaiting(DUL_NETWORKKEY * callerNet, OFTimeValue timeout);
 
 /*
  * functions allowing to retrieve raw A-ASSOCIATE PDUs from the DUL layer
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scpcfg.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scpcfg.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scpcfg.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scpcfg.h	2017-12-18 10:00:40.759875502 +0100
@@ -160,18 +160,18 @@
    *  for DIMSE blocking mode messaging (see also setDIMSEBlockingMode().
    *  @param dimseTimeout [in] DIMSE receive timeout in seconds
    */
-  void setDIMSETimeout(const Uint32 dimseTimeout);
+  void setDIMSETimeout(const OFTimeValue dimseTimeout);
 
   /** Set the timeout used during ACSE messaging protocol.
    *  @param acseTimeout [in] ACSE timeout in seconds.
    */
-  void setACSETimeout(const Uint32 acseTimeout);
+  void setACSETimeout(const OFTimeValue acseTimeout);
 
   /** Set the timeout that should be waited for connection requests.
    *  Only relevant in non-blocking mode (default).
    *  @param timeout [in] TCP/IP connection timeout in seconds.
    */
-  void setConnectionTimeout(const Uint32 timeout);
+  void setConnectionTimeout(const OFTimeValue timeout);
 
   /** Set whether to show presentation contexts in verbose or debug mode
    *  @param mode [in] Show presentation contexts in verbose mode if OFTrue. By default, the
@@ -250,17 +250,17 @@
   /** Returns DIMSE timeout (only applicable in blocking mode)
    *  @return DIMSE timeout in seconds
    */
-  Uint32 getDIMSETimeout() const;
+  OFTimeValue getDIMSETimeout() const;
 
   /** Returns ACSE timeout
    *  @return ACSE timeout in seconds
    */
-  Uint32 getACSETimeout() const;
+  OFTimeValue getACSETimeout() const;
 
   /** Returns connection timeout
    *  @return TCP/IP connection timeout in seconds
    */
-  Uint32 getConnectionTimeout() const;
+  OFTimeValue getConnectionTimeout() const;
 
   /** Returns the verbose presentation context mode configured specifying whether details on
    *  the presentation contexts (negotiated during association setup) should be shown in
@@ -358,11 +358,11 @@
 
   /// Timeout for DIMSE operations in seconds. Maximum time in DIMSE non-blocking mode to
   /// wait for incoming DIMSE data.
-  Uint32 m_dimseTimeout;
+  OFTimeValue m_dimseTimeout;
 
   /// Timeout for ACSE operations in seconds. Maximum time during association negotiation
   /// which is given for the SCU to follow the ACSE protocol.
-  Uint32 m_acseTimeout;
+  OFTimeValue m_acseTimeout;
 
   /// Verbose PC mode. Flags specifying whether details on the presentation contexts
   /// (negotiated during association setup) should be shown in verbose or debug mode.
@@ -371,7 +371,7 @@
   /// Timeout in seconds that should be waited for an incoming TCP/IP connection until
   /// the call returns. It is only relevant if the the SCP is set to non-blocking
   /// connection mode. Otherwise, the timeout is ignored. Default is 1000 seconds.
-  Uint32 m_connectionTimeout;
+  OFTimeValue m_connectionTimeout;
 
   /// If set, the AE title as received in the request (called AE title) is used in response
   /// (default: OFTrue).
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scp.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scp.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scp.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scp.h	2017-12-18 10:00:50.157454869 +0100
@@ -57,7 +57,7 @@
   /// Process ID
   int processId;
   /// Start time
-  time_t startTime;
+  OFTimeValue startTime;
   /// Indicator if process has storage ability
   OFBool hasStorageAbility;
 };
@@ -266,18 +266,18 @@
    *  for DIMSE blocking mode messaging (see also setDIMSEBlockingMode()).
    *  @param dimseTimeout [in] DIMSE receive timeout in seconds
    */
-  void setDIMSETimeout(const Uint32 dimseTimeout);
+  void setDIMSETimeout(const OFTimeValue dimseTimeout);
 
   /** Set the timeout used during ACSE messaging protocol.
    *  @param acseTimeout [in] ACSE timeout in seconds.
    */
-  void setACSETimeout(const Uint32 acseTimeout);
+  void setACSETimeout(const OFTimeValue acseTimeout);
 
   /** Set the timeout that should be waited for connection requests.
    *  Only relevant in non-blocking mode (default).
    *  @param timeout [in] TCP/IP connection timeout in seconds.
    */
-  void setConnectionTimeout(const Uint32 timeout);
+  void setConnectionTimeout(const OFTimeValue timeout);
 
   /** Set whether to show presentation contexts in verbose or debug mode
    *  @param mode [in] Show presentation contexts in verbose mode if OFTrue. By default, the
@@ -355,17 +355,17 @@
   /** Returns DIMSE timeout (only applicable in blocking mode)
    *  @return DIMSE timeout in seconds
    */
-  Uint32 getDIMSETimeout() const;
+  OFTimeValue getDIMSETimeout() const;
 
   /** Returns ACSE timeout
    *  @return ACSE timeout in seconds
    */
-  Uint32 getACSETimeout() const;
+  OFTimeValue getACSETimeout() const;
 
   /** Returns connection timeout
    *  @return TCP/IP connection timeout in seconds
    */
-  Uint32 getConnectionTimeout() const;
+  OFTimeValue getConnectionTimeout() const;
 
   /** Returns the verbose presentation context mode configured specifying whether details on
    *  the presentation contexts (negotiated during association setup) should be shown in
@@ -1040,7 +1040,7 @@
                                   T_DIMSE_Message *message,
                                   DcmDataset **statusDetail,
                                   DcmDataset **commandSet = NULL,
-                                  const Uint32 timeout = 0);
+                                  const OFTimeValue timeout = 0);
 
   /** Receive one dataset (of instance data) via network from another DICOM application
    *  @param presID     [out]   Contains in the end the ID of the presentation context
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scu.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scu.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/include/dcmtk/dcmnet/scu.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/include/dcmtk/dcmnet/scu.h	2017-12-18 09:59:05.778331249 +0100
@@ -555,7 +555,7 @@
    */
   virtual OFCondition handleEVENTREPORTRequest(DcmDataset *&reqDataset,
                                                Uint16 &eventTypeID,
-                                               const int timeout = 0);
+                                               const OFTimeValue timeout = 0);
 
   /** Closes the association created by this SCU. Also resets the current association.
    *  @deprecated The use of this method is deprecated. Please use releaseAssociation()
@@ -616,13 +616,13 @@
    *                           will try to read data from the incoming socket stream
    *                           for the number of seconds configured.
    */
-  void setDIMSETimeout(const Uint32 dimseTimeout);
+  void setDIMSETimeout(const OFTimeValue dimseTimeout);
 
   /** Set timeout for receiving ACSE messages
    *  @param acseTimeout [in] ACSE timeout in seconds used by timer for message timeouts
    *                          during association negotiation
    */
-  void setACSETimeout(const Uint32 acseTimeout);
+  void setACSETimeout(const OFTimeValue acseTimeout);
 
   /** Set global timeout for connecting to the SCP. Note that this is a global
    *  DCMTK setting i.e. it affects all code that uses dcmnet to start a DICOM
@@ -633,7 +633,7 @@
    *  @param connectionTimeout [in] Connection Timeout in seconds when connecting
    *                                to SCPs. -1 will wait forever (blocking mode).
    */
-  void setConnectionTimeout(const Sint32 connectionTimeout);
+  void setConnectionTimeout(const OFTimeValue connectionTimeout);
 
 
   /** Set an association configuration file and profile to be used
@@ -718,20 +718,20 @@
    *  the incoming socket stream for the number of seconds configured.
    *  @return The DIMSE timeout (in seconds) configured
    */
-  Uint32 getDIMSETimeout() const;
+  OFTimeValue getDIMSETimeout() const;
 
   /** Returns ACSE timeout in seconds used by timer for message timeouts during
    *  association negotiation.
    *  @return The ACSE timeout (in seconds) configured
    */
-  Uint32 getACSETimeout() const;
+  OFTimeValue getACSETimeout() const;
 
   /** Returns the timeout configured defining how long SCU will wait for the
    *  SCP when requesting an association. -1 means infinite waiting (blocking),
    *  0 means no waiting at all. Note that this is currently a global DCMTK setting.
    *  @return The connection timeout (in seconds)
    */
-  Sint32 getConnectionTimeout() const;
+  OFTimeValue getConnectionTimeout() const;
 
   /** Returns the storage directory used for storing objects received with C-STORE requests
    *  in the context of C-GET sessions. Default is empty string which refers to the current
@@ -840,7 +840,7 @@
                                   T_DIMSE_Message *msg,
                                   DcmDataset **statusDetail,
                                   DcmDataset **commandSet = NULL,
-                                  const Uint32 timeout = 0);
+                                  const OFTimeValue timeout = 0);
 
   /** Receives one dataset (of instance data) via network from another DICOM application
    *  @param presID     [out] Contains in the end the ID of the presentation context which
@@ -1041,10 +1041,10 @@
   Uint16 m_peerPort;
 
   /// DIMSE timeout (default: unlimited)
-  Uint32 m_dimseTimeout;
+  OFTimeValue m_dimseTimeout;
 
   /// ACSE timeout (default: 30 seconds)
-  Uint32 m_acseTimeout;
+  OFTimeValue m_acseTimeout;
 
   /// Storage directory for objects received with C-STORE due to a running
   /// C-GET session. By default, the received objects are stored in the current
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/assoc.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/assoc.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/assoc.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/assoc.cc	2017-12-18 10:02:51.203822623 +0100
@@ -225,7 +225,7 @@
 OFCondition
 ASC_initializeNetwork(T_ASC_NetworkRole role,
                       int acceptorPort,
-                      int timeout,
+                      OFTimeValue timeout,
                       T_ASC_Network ** network,
                       unsigned long options)
 {
@@ -1660,7 +1660,7 @@
 
 OFBool
 ASC_selectReadableAssociation(T_ASC_Association* assocs[],
-        int assocCount, int timeout)
+        int assocCount, OFTimeValue timeout)
 {
   if (assocCount <= 0) return OFFalse;
 
@@ -1686,13 +1686,13 @@
 }
 
 OFBool
-ASC_dataWaiting(T_ASC_Association * association, int timeout)
+ASC_dataWaiting(T_ASC_Association * association, OFTimeValue timeout)
 {
   return DUL_dataWaiting(association->DULassociation, timeout);
 }
 
 OFBool
-ASC_associationWaiting(T_ASC_Network * network, int timeout)
+ASC_associationWaiting(T_ASC_Network * network, OFTimeValue timeout)
 {
 #ifdef _WIN32
     SOCKET s;
@@ -1775,7 +1775,7 @@
                        unsigned long *associatePDUlength,
                        OFBool useSecureLayer,
                        DUL_BLOCKOPTIONS block,
-                       int timeout)
+                       OFTimeValue timeout)
 {
     T_ASC_Parameters *params;
     DUL_ASSOCIATIONKEY *DULassociation;
@@ -1923,7 +1923,7 @@
                        void **associatePDU,
                        unsigned long *associatePDUlength,
                        DUL_BLOCKOPTIONS block,
-                       int timeout)
+                       OFTimeValue timeout)
 {
     OFCondition cond = EC_Normal;
     long sendLen;
@@ -2167,7 +2167,7 @@
 
 
 OFCondition
-ASC_dropSCPAssociation(T_ASC_Association * association, int timeout)
+ASC_dropSCPAssociation(T_ASC_Association * association, OFTimeValue timeout)
 {
     /* if already dead don't worry */
     if (association == NULL) return EC_Normal;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dcmtrans.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dcmtrans.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dcmtrans.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dcmtrans.cc	2017-12-18 09:55:50.467676106 +0100
@@ -62,8 +62,8 @@
 #endif
 };
 
-OFGlobal<Sint32> dcmSocketSendTimeout(60);
-OFGlobal<Sint32> dcmSocketReceiveTimeout(60);
+OFGlobal<OFTimeValue> dcmSocketSendTimeout(60);
+OFGlobal<OFTimeValue> dcmSocketReceiveTimeout(60);
 
 DcmTransportConnection::DcmTransportConnection(DcmNativeSocketType openSocket)
 : theSocket(openSocket)
@@ -74,7 +74,7 @@
 #warning The macro DISABLE_SEND_TIMEOUT is not supported anymore. See "macros.txt" for details.
 #endif
     /* get global timeout for the send() function */
-    const Sint32 sendTimeout = dcmSocketSendTimeout.get();
+    const OFTimeValue sendTimeout = dcmSocketSendTimeout.get();
     if (sendTimeout >= 0)
     {
       if (sendTimeout == 0)
@@ -83,7 +83,7 @@
         DCMNET_DEBUG("setting network send timeout to " << sendTimeout << " seconds");
 #ifdef HAVE_WINSOCK_H
       // for Windows, specify send timeout in milliseconds
-      int timeoutVal = sendTimeout * 1000;
+      OFTimeValue timeoutVal = sendTimeout * 1000;
       if (setsockopt(theSocket, SOL_SOCKET, SO_SNDTIMEO, (char *) &timeoutVal, sizeof(timeoutVal)) < 0)
 #else
       // for other systems, specify send timeout as timeval struct
@@ -103,7 +103,7 @@
 #warning The macro DISABLE_RECV_TIMEOUT is not supported anymore. See "macros.txt" for details.
 #endif
     /* get global timeout for the recv() function */
-    const Sint32 recvTimeout = dcmSocketReceiveTimeout.get();
+    const OFTimeValue recvTimeout = dcmSocketReceiveTimeout.get();
     if (recvTimeout >= 0)
     {
       if (recvTimeout == 0)
@@ -112,7 +112,7 @@
         DCMNET_DEBUG("setting network receive timeout to " << recvTimeout << " seconds");
 #ifdef HAVE_WINSOCK_H
       // for Windows, specify receive timeout in milliseconds
-      int timeoutVal = recvTimeout * 1000;
+      OFTimeValue timeoutVal = recvTimeout * 1000;
       if (setsockopt(theSocket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeoutVal, sizeof(timeoutVal)) < 0)
 #else
       // for other systems, specify receive timeout as timeval struct
@@ -135,7 +135,7 @@
 {
 }
 
-OFBool DcmTransportConnection::safeSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout)
+OFBool DcmTransportConnection::safeSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout)
 {
   int numberOfRounds = timeout+1;
   if (numberOfRounds < 0) numberOfRounds = 0xFFFF; /* a long time */
@@ -180,7 +180,7 @@
   return found;
 }
 
-OFBool DcmTransportConnection::fastSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout)
+OFBool DcmTransportConnection::fastSelectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout)
 {
 
 #ifdef _WIN32
@@ -196,7 +196,7 @@
   fd_set fdset;
   FD_ZERO(&fdset);
   OFTimer timer;
-  int lTimeout = timeout;
+  OFTimeValue lTimeout = timeout;
 
   for (i=0; i<connCount; i++)
   {
@@ -236,7 +236,7 @@
         // check for interrupt call
         if (OFStandard::getLastNetworkErrorCode().value() == DCMNET_EINTR)
         {
-            int diff = OFstatic_cast(int, timer.getDiff());
+            OFTimeValue diff = OFstatic_cast(OFTimeValue, timer.getDiff());
             if (diff < timeout)
             {
                 lTimeout = timeout - diff;
@@ -263,7 +263,7 @@
   return OFTrue;
 }
 
-OFBool DcmTransportConnection::selectReadableAssociation(DcmTransportConnection *connections[], int connCount, int timeout)
+OFBool DcmTransportConnection::selectReadableAssociation(DcmTransportConnection *connections[], int connCount, OFTimeValue timeout)
 {
   OFBool canUseFastMode = OFTrue;
   for (int i=0; i<connCount; i++)
@@ -350,13 +350,13 @@
   return 0;
 }
 
-OFBool DcmTCPConnection::networkDataAvailable(int timeout)
+OFBool DcmTCPConnection::networkDataAvailable(OFTimeValue timeout)
 {
   struct timeval t;
   fd_set fdset;
   int nfound;
   OFTimer timer;
-  int lTimeout = timeout;
+  OFTimeValue lTimeout = timeout;
 
   FD_ZERO(&fdset);
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dfindscu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dfindscu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dfindscu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dfindscu.cc	2017-12-18 09:56:23.078032504 +0100
@@ -144,7 +144,7 @@
     dropNetwork();
 }
 
-OFCondition DcmFindSCU::initializeNetwork(int acse_timeout)
+OFCondition DcmFindSCU::initializeNetwork(OFTimeValue acse_timeout)
 {
     return ASC_initializeNetwork(NET_REQUESTOR, 0, acse_timeout, &net_);
 }
@@ -167,7 +167,7 @@
     const char *abstractSyntax,
     E_TransferSyntax preferredTransferSyntax,
     T_DIMSE_BlockingMode blockMode,
-    int dimse_timeout,
+    OFTimeValue dimse_timeout,
     Uint32 maxReceivePDULength,
     OFBool secureConnection,
     OFBool abortAssociation,
@@ -418,7 +418,7 @@
     int repeatCount,
     const char *abstractSyntax,
     T_DIMSE_BlockingMode blockMode,
-    int dimse_timeout,
+    OFTimeValue dimse_timeout,
     OFBool extractResponsesToFile,
     int cancelAfterNResponses,
     OFList<OFString> *overrideKeys,
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimecho.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimecho.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimecho.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimecho.cc	2017-12-18 09:54:57.316774411 +0100
@@ -97,7 +97,7 @@
 	/* in */
 	T_ASC_Association *assoc, DIC_US msgId,
 	/* blocking info for response */
-	T_DIMSE_BlockingMode blockMode, int timeout,
+	T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
 	/* out */
 	DIC_US *status, DcmDataset **statusDetail)
 {
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimfind.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimfind.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimfind.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimfind.cc	2017-12-18 09:54:43.072781023 +0100
@@ -106,7 +106,7 @@
         T_ASC_PresentationContextID presID,
         T_DIMSE_C_FindRQ *request, DcmDataset *requestIdentifiers,
         DIMSE_FindUserCallback callback, void *callbackData,
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         T_DIMSE_C_FindRSP *response, DcmDataset **statusDetail)
     /*
      * This function sends a C-FIND-RQ message and data set information containing the given
@@ -329,7 +329,7 @@
         T_ASC_PresentationContextID presIdCmd,
         T_DIMSE_C_FindRQ *request,
         DIMSE_FindProviderCallback callback, void *callbackData,
-        T_DIMSE_BlockingMode blockMode, int timeout)
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
     /*
      * This function receives a data set which represents the search mask over the network and
      * stores this data in memory. Then, it tries to select corresponding records which match the
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimget.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimget.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimget.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimget.cc	2017-12-18 09:55:06.556984368 +0100
@@ -39,7 +39,7 @@
 static int
 selectReadable(T_ASC_Association *assoc, 
     T_ASC_Network *net, T_ASC_Association *subAssoc,
-    T_DIMSE_BlockingMode blockMode, int timeout)
+    T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
 {
     T_ASC_Association *assocList[2];
     int assocCount = 0;
@@ -86,7 +86,7 @@
         DcmDataset *requestIdentifiers,
         DIMSE_GetUserCallback callback, void *callbackData,
         /* blocking info for response */
-        T_DIMSE_BlockingMode blockMode, int timeout,
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
         /* sub-operation provider callback */
         T_ASC_Network *net,
         DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData,
@@ -290,7 +290,7 @@
         T_DIMSE_C_GetRQ *request,
         DIMSE_GetProviderCallback callback, void *callbackData,
         /* blocking info for data set */
-        T_DIMSE_BlockingMode blockMode, int timeout)
+        T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
 {       
     T_ASC_PresentationContextID presIdData;
     DcmDataset *statusDetail = NULL;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimmove.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimmove.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimmove.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimmove.cc	2017-12-18 09:56:32.771040565 +0100
@@ -105,7 +105,7 @@
     T_ASC_Association *assoc,
     T_ASC_Network *net,
     T_ASC_Association *subAssoc,
-    T_DIMSE_BlockingMode blockMode, int timeout)
+    T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
 {
     T_ASC_Association *assocList[2];
     int assocCount = 0;
@@ -152,7 +152,7 @@
     DcmDataset *requestIdentifiers,
     DIMSE_MoveUserCallback callback, void *callbackData,
     /* blocking info for response */
-    T_DIMSE_BlockingMode blockMode, int timeout,
+    T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
     /* sub-operation provider callback */
     T_ASC_Network *net,
     DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData,
@@ -370,7 +370,7 @@
     T_DIMSE_C_MoveRQ *request,
     DIMSE_MoveProviderCallback callback, void *callbackData,
     /* blocking info for data set */
-    T_DIMSE_BlockingMode blockMode, int timeout)
+    T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
 {
     OFCondition cond = EC_Normal;
     T_ASC_PresentationContextID presIdData;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimse.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimse.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimse.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimse.cc	2017-12-18 10:03:25.377656301 +0100
@@ -218,7 +218,7 @@
 DIMSE_readNextPDV(
         T_ASC_Association *assoc,
         T_DIMSE_BlockingMode blocking,
-        int timeout,
+        OFTimeValue timeout,
         DUL_PDV *pdv)
     /*
      * This function returns the next PDV which was (earlier or just now) received on the incoming
@@ -1075,7 +1075,7 @@
 OFCondition DIMSE_ignoreDataSet(
         T_ASC_Association *assoc,
         T_DIMSE_BlockingMode blocking,
-        int timeout,
+        OFTimeValue timeout,
         DIC_UL *bytesRead,
         DIC_UL *pdvCount)
 {
@@ -1104,7 +1104,7 @@
 DIMSE_receiveCommand(
         T_ASC_Association *assoc,
         T_DIMSE_BlockingMode blocking,
-        int timeout,
+        OFTimeValue timeout,
         T_ASC_PresentationContextID*presID,
         T_DIMSE_Message *msg,
         DcmDataset **statusDetail,
@@ -1460,7 +1460,7 @@
 DIMSE_receiveDataSetInFile(
         T_ASC_Association *assoc,
         T_DIMSE_BlockingMode blocking,
-        int timeout,
+        OFTimeValue timeout,
         T_ASC_PresentationContextID *presID,
         DcmOutputStream *filestream,
         DIMSE_ProgressCallback callback,
@@ -1563,7 +1563,7 @@
 DIMSE_receiveDataSetInMemory(
         T_ASC_Association *assoc,
         T_DIMSE_BlockingMode blocking,
-        int timeout,
+        OFTimeValue timeout,
         T_ASC_PresentationContextID *presID,
         DcmDataset **dataObject,
         DIMSE_ProgressCallback callback,
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimstore.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimstore.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dimstore.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dimstore.cc	2017-12-18 09:55:16.943757870 +0100
@@ -140,7 +140,7 @@
 	T_DIMSE_C_StoreRQ *request,
 	const char *imageFileName, DcmDataset *imageDataSet,
 	DIMSE_StoreUserCallback callback, void *callbackData,
-	T_DIMSE_BlockingMode blockMode, int timeout,
+	T_DIMSE_BlockingMode blockMode, OFTimeValue timeout,
 	T_DIMSE_C_StoreRSP *response,
 	DcmDataset **statusDetail,
         T_DIMSE_DetectedCancelParameters *checkForCancelParams,
@@ -372,7 +372,7 @@
 	const char* imageFileName, int writeMetaheader,
 	DcmDataset **imageDataSet,
 	DIMSE_StoreProviderCallback callback, void *callbackData,
-	T_DIMSE_BlockingMode blockMode, int timeout)
+	T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
     /*
      * This function receives a data set over the network and either stores this data in a file (exactly as it was
      * received) or it stores this data in memory. Before, during and after the process of receiving data, the callback
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dul.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dul.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dul.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dul.cc	2017-12-18 10:03:06.887415448 +0100
@@ -148,7 +148,7 @@
 #include "dcmtk/ofstd/ofnetdb.h"
 
 OFGlobal<OFBool> dcmDisableGethostbyaddr(OFFalse);
-OFGlobal<Sint32> dcmConnectionTimeout(-1);
+OFGlobal<OFTimeValue> dcmConnectionTimeout(-1);
 OFGlobal<DcmNativeSocketType> dcmExternalSocketHandle(DCMNET_INVALID_SOCKET);
 OFGlobal<const char *> dcmTCPWrapperDaemonName((const char *)NULL);
 OFGlobal<unsigned long> dcmEnableBackwardCompatibility(0);
@@ -156,7 +156,7 @@
 static int networkInitialized = 0;
 
 static OFCondition
-createNetworkKey(const char *mode, int timeout, unsigned long opt,
+createNetworkKey(const char *mode, OFTimeValue timeout, unsigned long opt,
                  PRIVATE_NETWORKKEY ** k);
 static OFCondition
 createAssociationKey(PRIVATE_NETWORKKEY ** network, const char *node,
@@ -166,13 +166,13 @@
 static OFCondition
 receiveTransportConnection(PRIVATE_NETWORKKEY ** network,
                            DUL_BLOCKOPTIONS block,
-                           int timeout,
+                           OFTimeValue timeout,
                            DUL_ASSOCIATESERVICEPARAMETERS * params,
                            PRIVATE_ASSOCIATIONKEY ** association);
 static OFCondition
 receiveTransportConnectionTCP(PRIVATE_NETWORKKEY ** network,
                               DUL_BLOCKOPTIONS block,
-                              int timeout,
+                              OFTimeValue timeout,
                               DUL_ASSOCIATESERVICEPARAMETERS * params,
                               PRIVATE_ASSOCIATIONKEY ** association);
 
@@ -366,7 +366,7 @@
 */
 OFCondition
 DUL_InitializeNetwork(const char *mode,
-                      void *networkParameter, int timeout, unsigned long opt,
+                      void *networkParameter, OFTimeValue timeout, unsigned long opt,
                       DUL_NETWORKKEY ** networkKey)
 {
     // default return value if something goes wrong
@@ -489,7 +489,7 @@
 DUL_RequestAssociation(
   DUL_NETWORKKEY ** callerNetworkKey,
   DUL_BLOCKOPTIONS block,
-  int timeout,
+  OFTimeValue timeout,
   DUL_ASSOCIATESERVICEPARAMETERS * params,
   DUL_ASSOCIATIONKEY ** callerAssociation,
   int activatePDUStorage)
@@ -622,7 +622,7 @@
 DUL_ReceiveAssociationRQ(
   DUL_NETWORKKEY ** callerNetworkKey,
   DUL_BLOCKOPTIONS block,
-  int timeout,
+  OFTimeValue timeout,
   DUL_ASSOCIATESERVICEPARAMETERS * params,
   DUL_ASSOCIATIONKEY ** callerAssociation,
   int activatePDUStorage)
@@ -1170,7 +1170,7 @@
 */
 OFCondition
 DUL_ReadPDVs(DUL_ASSOCIATIONKEY ** callerAssociation,
-             DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, int timeout)
+             DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, OFTimeValue timeout)
 {
     PRIVATE_ASSOCIATIONKEY
         ** association;
@@ -1486,7 +1486,7 @@
 static OFCondition
 receiveTransportConnection(PRIVATE_NETWORKKEY ** network,
                            DUL_BLOCKOPTIONS block,
-                           int timeout,
+                           OFTimeValue timeout,
                            DUL_ASSOCIATESERVICEPARAMETERS * params,
                            PRIVATE_ASSOCIATIONKEY ** association)
 {
@@ -1519,7 +1519,7 @@
 static OFCondition
 receiveTransportConnectionTCP(PRIVATE_NETWORKKEY ** network,
                               DUL_BLOCKOPTIONS block,
-                              int timeout,
+                              OFTimeValue timeout,
                               DUL_ASSOCIATESERVICEPARAMETERS * params,
                               PRIVATE_ASSOCIATIONKEY ** association)
 {
@@ -2030,7 +2030,7 @@
 */
 static OFCondition
 createNetworkKey(const char *mode,
-                 int timeout, unsigned long opt, PRIVATE_NETWORKKEY ** key)
+                 OFTimeValue timeout, unsigned long opt, PRIVATE_NETWORKKEY ** key)
 {
     if (strcmp(mode, AE_REQUESTOR) != 0 &&
         strcmp(mode, AE_ACCEPTOR) != 0 &&
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulextra.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulextra.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulextra.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulextra.cc	2017-12-18 09:54:52.468089513 +0100
@@ -105,7 +105,7 @@
 #include "dcmtk/dcmnet/diutil.h"
 
 OFBool
-DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, int timeout)
+DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, OFTimeValue timeout)
 {
     PRIVATE_ASSOCIATIONKEY * association = (PRIVATE_ASSOCIATIONKEY *)callerAssociation;
     if ((association==NULL)||(association->connection == NULL)) return OFFalse;
@@ -126,7 +126,7 @@
 }
 
 OFBool
-DUL_associationWaiting(DUL_NETWORKKEY * callerNet, int timeout)
+DUL_associationWaiting(DUL_NETWORKKEY * callerNet, OFTimeValue timeout)
 {
     PRIVATE_NETWORKKEY *net;
     DcmNativeSocketType s;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulfsm.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulfsm.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulfsm.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulfsm.cc	2017-12-18 10:41:57.049202070 +0100
@@ -257,35 +257,35 @@
 static OFCondition
 readPDUHead(PRIVATE_ASSOCIATIONKEY ** association,
             unsigned char *buffer, unsigned long maxlength,
-            DUL_BLOCKOPTIONS block, int timeout,
+            DUL_BLOCKOPTIONS block, OFTimeValue timeout,
             unsigned char *PDUtype, unsigned char *PDUreserved,
             unsigned long *PDULength);
 static OFCondition
 readPDU(PRIVATE_ASSOCIATIONKEY ** association, DUL_BLOCKOPTIONS block,
-        int timeout, unsigned char **buffer,
+        OFTimeValue timeout, unsigned char **buffer,
         unsigned char *pduType, unsigned char *pduReserved,
         unsigned long *pduLength);
 static OFCondition
 readPDUBody(PRIVATE_ASSOCIATIONKEY ** association,
-            DUL_BLOCKOPTIONS block, int timeout,
+            DUL_BLOCKOPTIONS block, OFTimeValue timeout,
             unsigned char *buffer, unsigned long maxLength,
             unsigned char *pduType, unsigned char *pduReserved,
             unsigned long *pduLength);
 static OFCondition
 readPDUHeadTCP(PRIVATE_ASSOCIATIONKEY ** association,
                unsigned char *buffer, unsigned long maxLength,
-               DUL_BLOCKOPTIONS block, int timeout,
+               DUL_BLOCKOPTIONS block, OFTimeValue timeout,
                unsigned char *PDUtype, unsigned char *PDUreserved,
                unsigned long *PDULength);
 static OFCondition
 readPDUBodyTCP(PRIVATE_ASSOCIATIONKEY ** association,
-               DUL_BLOCKOPTIONS block, int timeout,
+               DUL_BLOCKOPTIONS block, OFTimeValue timeout,
                unsigned char *buffer, unsigned long maxLength,
                unsigned char *pduType, unsigned char *pduReserved,
                unsigned long *pduLength);
 static OFCondition
-defragmentTCP(DcmTransportConnection *connection, DUL_BLOCKOPTIONS block, time_t timerStart,
-              int timeout, void *b, unsigned long l, unsigned long *rtnLen);
+defragmentTCP(DcmTransportConnection *connection, DUL_BLOCKOPTIONS block, OFTimeValue timerStart,
+              OFTimeValue timeout, void *b, unsigned long l, unsigned long *rtnLen);
 
 static OFString dump_pdu(const char *type, void *buffer, unsigned long length);
 
@@ -2262,7 +2262,7 @@
     server.sin_port = (unsigned short) htons(port);
 
     // get global connection timeout
-    Sint32 connectTimeout = dcmConnectionTimeout.get();
+    OFTimeValue connectTimeout = dcmConnectionTimeout.get();
 
 #ifdef HAVE_WINSOCK_H
     u_long arg = TRUE;
@@ -3202,7 +3202,7 @@
 
 OFCondition
 PRV_NextPDUType(PRIVATE_ASSOCIATIONKEY ** association, DUL_BLOCKOPTIONS block,
-                int timeout, unsigned char *pduType)
+                OFTimeValue timeout, unsigned char *pduType)
 {
     OFCondition cond = EC_Normal;
 
@@ -3256,7 +3256,7 @@
 
 static OFCondition
 readPDU(PRIVATE_ASSOCIATIONKEY ** association, DUL_BLOCKOPTIONS block,
-        int timeout, unsigned char **buffer,
+        OFTimeValue timeout, unsigned char **buffer,
         unsigned char *pduType, unsigned char *pduReserved,
         unsigned long *pduLength)
 {
@@ -3316,7 +3316,7 @@
 static OFCondition
 readPDUHead(PRIVATE_ASSOCIATIONKEY ** association,
             unsigned char *buffer, unsigned long maxLength,
-            DUL_BLOCKOPTIONS block, int timeout,
+            DUL_BLOCKOPTIONS block, OFTimeValue timeout,
             unsigned char *PDUType, unsigned char *PDUReserved,
             unsigned long *PDULength)
 {
@@ -3384,7 +3384,7 @@
 
 static OFCondition
 readPDUBody(PRIVATE_ASSOCIATIONKEY ** association,
-            DUL_BLOCKOPTIONS block, int timeout,
+            DUL_BLOCKOPTIONS block, OFTimeValue timeout,
             unsigned char *buffer, unsigned long maxLength,
             unsigned char *pduType, unsigned char *pduReserved,
             unsigned long *pduLength)
@@ -3433,7 +3433,7 @@
 static OFCondition
 readPDUHeadTCP(PRIVATE_ASSOCIATIONKEY ** association,
                unsigned char *buffer, unsigned long maxLength,
-               DUL_BLOCKOPTIONS block, int timeout,
+               DUL_BLOCKOPTIONS block, OFTimeValue timeout,
      unsigned char *type, unsigned char *reserved, unsigned long *pduLength)
 {
     unsigned long
@@ -3540,7 +3540,7 @@
 
 static OFCondition
 readPDUBodyTCP(PRIVATE_ASSOCIATIONKEY ** association,
-               DUL_BLOCKOPTIONS block, int timeout,
+               DUL_BLOCKOPTIONS block, OFTimeValue timeout,
                unsigned char *buffer, unsigned long maxLength,
                unsigned char *pduType, unsigned char *pduReserved,
                unsigned long *pduLength)
@@ -3619,8 +3619,8 @@
 
 
 static OFCondition
-defragmentTCP(DcmTransportConnection *connection, DUL_BLOCKOPTIONS block, time_t timerStart,
-              int timeout, void *p, unsigned long l, unsigned long *rtnLen)
+defragmentTCP(DcmTransportConnection *connection, DUL_BLOCKOPTIONS block, OFTimeValue timerStart,
+              OFTimeValue timeout, void *p, unsigned long l, unsigned long *rtnLen)
 {
     unsigned char *b;
     int bytesRead;
@@ -3662,7 +3662,7 @@
             if (block == DUL_NOBLOCK)
             {
                 /* determine remaining time to wait */
-                timeToWait = timeout - (int) (time(NULL) - timerStart);
+                timeToWait = timeout - (time(NULL) - timerStart);
 
                 /* go ahead and see if within timeout seconds data will be received over the network. */
                 /* if not, return DUL_READTIMEOUT, if yes, stay in this function. */
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulpriv.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulpriv.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulpriv.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulpriv.h	2017-12-18 09:55:01.109524728 +0100
@@ -109,6 +109,6 @@
 	       PRV_ASSOCIATEPDU * pdu);
 OFCondition
 PRV_NextPDUType(PRIVATE_ASSOCIATIONKEY ** association,
-		DUL_BLOCKOPTIONS block, int timeout, unsigned char *type);
+		DUL_BLOCKOPTIONS block, OFTimeValue timeout, unsigned char *type);
 
 #endif
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulstruc.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulstruc.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/dulstruc.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/dulstruc.h	2017-12-18 09:55:31.125664019 +0100
@@ -95,7 +95,7 @@
     int applicationFunction;
     int networkState;
     int protocolState;
-    int timeout;
+    OFTimeValue timeout;
     unsigned long options;
     union {
   struct {
@@ -114,8 +114,8 @@
     DUL_ASSOC_STATE associationState;
     int protocolState;
     int networkState;
-    int timeout;
-    time_t timerStart;
+    OFTimeValue timeout;
+    OFTimeValue timerStart;
     unsigned long maxPDVRequestor;
     unsigned long maxPDVAcceptor;
     unsigned long maxPDV;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scp.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scp.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scp.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scp.cc	2017-12-18 10:03:49.343042230 +0100
@@ -315,11 +315,11 @@
   if (m_assoc != NULL)
     return DIMSE_ILLEGALASSOCIATION;
 
-  Uint32 timeout = m_cfg->getConnectionTimeout();
+  OFTimeValue timeout = m_cfg->getConnectionTimeout();
 
   // Listen to a socket for timeout seconds and wait for an association request
   OFCondition cond = ASC_receiveAssociation( network, &m_assoc, m_cfg->getMaxReceivePDULength(), NULL, NULL, OFFalse,
-                                             m_cfg->getConnectionBlockingMode(), OFstatic_cast(int, timeout) );
+                                             m_cfg->getConnectionBlockingMode(), OFstatic_cast(OFTimeValue, timeout) );
 
   // In case of a timeout in non-blocking mode, call notifier (and return
   // to main event loop later)
@@ -1439,7 +1439,7 @@
                                         T_DIMSE_Message *message,
                                         DcmDataset **statusDetail,
                                         DcmDataset **commandSet,
-                                        const Uint32 timeout)
+                                        const OFTimeValue timeout)
 {
   if (m_assoc == NULL)
     return DIMSE_ILLEGALASSOCIATION;
@@ -1693,21 +1693,21 @@
 
 // ----------------------------------------------------------------------------
 
-void DcmSCP::setDIMSETimeout(const Uint32 dimseTimeout)
+void DcmSCP::setDIMSETimeout(const OFTimeValue dimseTimeout)
 {
   m_cfg->setDIMSETimeout(dimseTimeout);
 }
 
 // ----------------------------------------------------------------------------
 
-void DcmSCP::setACSETimeout(const Uint32 acseTimeout)
+void DcmSCP::setACSETimeout(const OFTimeValue acseTimeout)
 {
   m_cfg->setACSETimeout(acseTimeout);
 }
 
 // ----------------------------------------------------------------------------
 
-void DcmSCP::setConnectionTimeout(const Uint32 timeout)
+void DcmSCP::setConnectionTimeout(const OFTimeValue timeout)
 {
   m_cfg->setConnectionTimeout(timeout);
 }
@@ -1793,21 +1793,21 @@
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCP::getDIMSETimeout() const
+OFTimeValue DcmSCP::getDIMSETimeout() const
 {
   return m_cfg->getDIMSETimeout();
 }
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCP::getConnectionTimeout() const
+OFTimeValue DcmSCP::getConnectionTimeout() const
 {
   return m_cfg->getConnectionTimeout();
 }
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCP::getACSETimeout() const
+OFTimeValue DcmSCP::getACSETimeout() const
 {
   return m_cfg->getACSETimeout();
 }
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scpcfg.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scpcfg.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scpcfg.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scpcfg.cc	2017-12-18 09:55:26.046399455 +0100
@@ -155,21 +155,21 @@
 
 // ----------------------------------------------------------------------------
 
-void DcmSCPConfig::setDIMSETimeout(const Uint32 dimseTimeout)
+void DcmSCPConfig::setDIMSETimeout(const OFTimeValue dimseTimeout)
 {
   m_dimseTimeout = dimseTimeout;
 }
 
 // ----------------------------------------------------------------------------
 
-void DcmSCPConfig::setACSETimeout(const Uint32 acseTimeout)
+void DcmSCPConfig::setACSETimeout(const OFTimeValue acseTimeout)
 {
   m_acseTimeout = acseTimeout;
 }
 
 // ----------------------------------------------------------------------------
 
-void DcmSCPConfig::setConnectionTimeout(const Uint32 timeout)
+void DcmSCPConfig::setConnectionTimeout(const OFTimeValue timeout)
 {
   m_connectionTimeout = timeout;
 }
@@ -255,21 +255,21 @@
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCPConfig::getDIMSETimeout() const
+OFTimeValue DcmSCPConfig::getDIMSETimeout() const
 {
   return m_dimseTimeout;
 }
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCPConfig::getConnectionTimeout() const
+OFTimeValue DcmSCPConfig::getConnectionTimeout() const
 {
   return m_connectionTimeout;
 }
 
 // ----------------------------------------------------------------------------
 
-Uint32 DcmSCPConfig::getACSETimeout() const
+OFTimeValue DcmSCPConfig::getACSETimeout() const
 {
   return m_acseTimeout;
 }
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmnet/libsrc/scu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmnet/libsrc/scu.cc	2017-12-18 10:04:00.331360885 +0100
@@ -1995,7 +1995,7 @@
 // Receives N-EVENT-REPORT request
 OFCondition DcmSCU::handleEVENTREPORTRequest(DcmDataset *&reqDataset,
                                              Uint16 &eventTypeID,
-                                             const int timeout)
+                                             const OFTimeValue timeout)
 {
   // Do some basic validity checks
   if (!isConnected())
@@ -2194,7 +2194,7 @@
                                         T_DIMSE_Message *msg,
                                         DcmDataset **statusDetail,
                                         DcmDataset **commandSet,
-                                        const Uint32 timeout)
+                                        const OFTimeValue timeout)
 {
   if (!isConnected())
     return DIMSE_ILLEGALASSOCIATION;
@@ -2281,19 +2281,19 @@
 }
 
 
-void DcmSCU::setDIMSETimeout(const Uint32 dimseTimeout)
+void DcmSCU::setDIMSETimeout(const OFTimeValue dimseTimeout)
 {
   m_dimseTimeout = dimseTimeout;
 }
 
 
-void DcmSCU::setACSETimeout(const Uint32 acseTimeout)
+void DcmSCU::setACSETimeout(const OFTimeValue acseTimeout)
 {
   m_acseTimeout = acseTimeout;
 }
 
 
-void DcmSCU::setConnectionTimeout(const Sint32 connectionTimeout)
+void DcmSCU::setConnectionTimeout(const OFTimeValue connectionTimeout)
 {
   dcmConnectionTimeout.set(connectionTimeout);
 }
@@ -2386,19 +2386,19 @@
 }
 
 
-Uint32 DcmSCU::getDIMSETimeout() const
+OFTimeValue DcmSCU::getDIMSETimeout() const
 {
   return m_dimseTimeout;
 }
 
 
-Uint32 DcmSCU::getACSETimeout() const
+OFTimeValue DcmSCU::getACSETimeout() const
 {
   return m_acseTimeout;
 }
 
 
-Sint32 DcmSCU::getConnectionTimeout() const
+OFTimeValue DcmSCU::getConnectionTimeout() const
 {
   return dcmConnectionTimeout.get();
 }
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmprscp.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmprscp.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmprscp.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmprscp.cc	2017-12-18 09:53:18.962180828 +0100
@@ -453,9 +453,9 @@
     }
 
 #ifdef HAVE_FORK
-    int timeout=1;
+    OFTimeValue timeout=1;
 #else
-    int timeout=1000;
+    OFTimeValue timeout=1000;
 #endif
 
     while (!finished)
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmprscu.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmprscu.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmprscu.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmprscu.cc	2017-12-18 09:52:59.974832402 +0100
@@ -805,7 +805,7 @@
     deleteTerminateJobs         = dvi.getSpoolerAlwaysDeleteTerminateJobs();
     useTLS                      = dvi.getTargetUseTLS(opt_printer);
 
-    Sint32 timeout = dvi.getTargetTimeout(opt_printer);
+    OFTimeValue timeout = dvi.getTargetTimeout(opt_printer);
     if (timeout > 0) dcmConnectionTimeout.set(timeout);
 
 #ifdef WITH_OPENSSL
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmpsrcv.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmpsrcv.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmpsrcv.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmpsrcv.cc	2017-12-18 09:53:17.501311076 +0100
@@ -1258,9 +1258,9 @@
       }
 
 #ifdef HAVE_FORK
-      int timeout=1;
+      OFTimeValue timeout=1;
 #else
-      int timeout=1000;
+      OFTimeValue timeout=1000;
 #endif
       while (!finished2)
       {
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmpssnd.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmpssnd.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/apps/dcmpssnd.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/apps/dcmpssnd.cc	2017-12-18 09:53:20.578343976 +0100
@@ -420,7 +420,7 @@
     OFBool keepMessagePortOpen    = dvi.getMessagePortKeepOpen();
     OFBool useTLS = dvi.getTargetUseTLS(opt_target);
 
-    Sint32 timeout = dvi.getTargetTimeout(opt_target);
+    OFTimeValue timeout = dvi.getTargetTimeout(opt_target);
     if (timeout > 0) dcmConnectionTimeout.set(timeout);
 
 #ifdef WITH_OPENSSL
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpscf.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpscf.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpscf.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpscf.h	2017-12-18 09:58:27.733318076 +0100
@@ -125,7 +125,7 @@
    *    identifiers returned by getTargetID().
    *  @return entry if present and parsable in the config file, -1 otherwise.
    */
-  Sint32 getTargetTimeout(const char *targetID);
+  OFTimeValue getTargetTimeout(const char *targetID);
 
   /** returns the IMPLICITONLY entry for the communication partner with the given
    *  target ID from the configuration file.
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpspr.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpspr.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpspr.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpspr.h	2017-12-18 09:58:43.831551430 +0100
@@ -285,7 +285,7 @@
   T_DIMSE_BlockingMode blockMode;
 
   /// timeout for receive
-  int timeout;
+  OFTimeValue timeout;
 };
 
 #endif
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpsprt.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpsprt.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/include/dcmtk/dcmpstat/dvpsprt.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/include/dcmtk/dcmpstat/dvpsprt.h	2017-12-18 09:58:37.959500430 +0100
@@ -272,7 +272,7 @@
 
   /** timeout for receive
    */
-  int timeout;
+  OFTimeValue timeout;
 
   /** basic film session instance
    */
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/libsrc/dviface.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/libsrc/dviface.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/libsrc/dviface.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/libsrc/dviface.cc	2017-12-18 10:41:48.797427883 +0100
@@ -1279,14 +1279,14 @@
     // date/time differences (i.e. over NFS)
 #ifdef HAVE_DECLARATION_STRUCT_UTIMBUF
     struct utimbuf utime_buf;
-    utime_buf.actime  = OFstatic_cast(time_t, referenceTime);
-    utime_buf.modtime = OFstatic_cast(time_t, referenceTime);
+    utime_buf.actime  = OFstatic_cast(OFTimeValue, referenceTime);
+    utime_buf.modtime = OFstatic_cast(OFTimeValue, referenceTime);
     if (0 != utime(databaseIndexFile.c_str(), &utime_buf))
 #else
-    // some old platforms use the prototype int utime(char *file, time_t timep[])
-    time_t utime_buf[2];
-    utime_buf[0]  = OFstatic_cast(time_t, referenceTime);
-    utime_buf[1] = OFstatic_cast(time_t, referenceTime);
+    // some old platforms use the prototype int utime(char *file, OFTimeValue timep[])
+    OFTimeValue utime_buf[2];
+    utime_buf[0]  = OFstatic_cast(OFTimeValue, referenceTime);
+    utime_buf[1] = OFstatic_cast(OFTimeValue, referenceTime);
     if (0 != utime(OFconst_cast(char *, databaseIndexFile.c_str()), utime_buf))
 #endif
     {
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/libsrc/dvpscf.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/libsrc/dvpscf.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmpstat/libsrc/dvpscf.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmpstat/libsrc/dvpscf.cc	2017-12-18 09:53:22.012734297 +0100
@@ -406,7 +406,7 @@
   return result;
 }
 
-Sint32 DVConfiguration::getTargetTimeout(const char *targetID)
+OFTimeValue DVConfiguration::getTargetTimeout(const char *targetID)
 {
   const char *c = getConfigEntry(L2_COMMUNICATION, targetID, L0_TIMEOUT);
   signed long result = -1; // default is -1
@@ -414,7 +414,7 @@
   {
     if (1 != sscanf(c, "%ld", &result)) result=0;
   }
-  return (Sint32) result;
+  return (OFTimeValue) result;
 }
 
 OFBool DVConfiguration::getTargetImplicitOnly(const char *targetID)
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/apps/dcmqrscp.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/apps/dcmqrscp.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/apps/dcmqrscp.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/apps/dcmqrscp.cc	2017-12-18 09:57:03.508328055 +0100
@@ -475,21 +475,21 @@
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        dcmConnectionTimeout.set((Sint32) opt_timeout);
+        dcmConnectionTimeout.set((OFTimeValue) opt_timeout);
       }
 
       if (cmd.findOption("--acse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        options.acse_timeout_ = OFstatic_cast(int, opt_timeout);
+        options.acse_timeout_ = OFstatic_cast(OFTimeValue, opt_timeout);
       }
 
       if (cmd.findOption("--dimse-timeout"))
       {
         OFCmdSignedInt opt_timeout = 0;
         app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-        options.dimse_timeout_ = OFstatic_cast(int, opt_timeout);
+        options.dimse_timeout_ = OFstatic_cast(OFTimeValue, opt_timeout);
         options.blockMode_ = DIMSE_NONBLOCKING;
       }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/apps/dcmqrti.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/apps/dcmqrti.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/apps/dcmqrti.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/apps/dcmqrti.cc	2017-12-18 09:56:41.066963338 +0100
@@ -85,7 +85,7 @@
   int remoteDBTitlesCount = 0;
   const char *configFileName = DEFAULT_CONFIGURATION_DIR "dcmqrscp.cfg";
   E_TransferSyntax networkTransferSyntax = EXS_Unknown;
-  int opt_acse_timeout = 30;
+  OFTimeValue opt_acse_timeout = 30;
 
   const char *currentPeer = NULL, **vendorHosts, **aeTitleList;
   OFBool noCommandLineValueForMaxReceivePDULength = OFTrue;
@@ -197,21 +197,21 @@
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      dcmConnectionTimeout.set(OFstatic_cast(Sint32, opt_timeout));
+      dcmConnectionTimeout.set(OFstatic_cast(OFTimeValue, opt_timeout));
     }
 
     if (cmd.findOption("--acse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
     }
 
     if (cmd.findOption("--dimse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app.checkValue(cmd.getValueAndCheckMin(opt_timeout, 1));
-      conf.setBlockMode(DIMSE_NONBLOCKING, OFstatic_cast(int, opt_timeout));
+      conf.setBlockMode(DIMSE_NONBLOCKING, OFstatic_cast(OFTimeValue, opt_timeout));
     }
 
     if (cmd.findOption("--disable-new-vr"))
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/include/dcmtk/dcmqrdb/dcmqropt.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/include/dcmtk/dcmqrdb/dcmqropt.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/include/dcmtk/dcmqrdb/dcmqropt.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/include/dcmtk/dcmqrdb/dcmqropt.h	2017-12-18 10:01:46.239149800 +0100
@@ -155,10 +155,10 @@
   T_DIMSE_BlockingMode blockMode_;
 
   /// timeout for DIMSE operations
-  int dimse_timeout_;
+  OFTimeValue dimse_timeout_;
 
   /// timeout for ACSE operations
-  int acse_timeout_;
+  OFTimeValue acse_timeout_;
 
   // association configuration file name
   OFString associationConfigFile;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrtis.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrtis.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrtis.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrtis.h	2017-12-18 10:01:57.787261360 +0100
@@ -63,7 +63,7 @@
     TI_ImageEntry *images[TI_MAXIMAGES];  /* array of image pointers */
     int     imageCount;
 
-    time_t lastQueryTime; /* time we last queried db */
+    OFTimeValue lastQueryTime; /* time we last queried db */
 };
 
 struct DCMTK_DCMQRDB_EXPORT TI_StudyEntry
@@ -74,7 +74,7 @@
     DIC_LO  patientID;
     TI_SeriesEntry  *series[TI_MAXSERIES];  /* array of series pointers */
     int     seriesCount;
-    time_t lastQueryTime; /* time we last queried db */
+    OFTimeValue lastQueryTime; /* time we last queried db */
 };
 
 
@@ -95,7 +95,7 @@
     int currentSeries;  /* index of current series in current study */
     int currentImage; /* index of current image in current study */
 
-    time_t lastQueryTime; /* time we last queried db */
+    OFTimeValue lastQueryTime; /* time we last queried db */
 
     OFBool isRemoteDB;  /* true if DB is remote */
 };
@@ -196,7 +196,7 @@
      *  @param blockMode blocking mode for DIMSE operations
      *  @param timeout timeout for DIMSE operations
      */
-    void setBlockMode(T_DIMSE_BlockingMode blockMode, int timeout)
+    void setBlockMode(T_DIMSE_BlockingMode blockMode, OFTimeValue timeout)
     {
       blockMode_ = blockMode;
       dimse_timeout_ = timeout;
@@ -236,7 +236,7 @@
     OFBool TI_buildRemoteStudies(TI_DBEntry *db);
     OFBool TI_buildRemoteSeries(TI_DBEntry *db, TI_StudyEntry *study);
     OFBool TI_dbReadable(const char *dbTitle);
-    time_t TI_dbModifyTime(const char *dbTitle);
+    OFTimeValue TI_dbModifyTime(const char *dbTitle);
     OFCondition addPresentationContexts(T_ASC_Parameters *params);
     void selectDestinationCharacterSet(OFString& destinationCharacterSet);
 
@@ -288,7 +288,7 @@
     T_DIMSE_BlockingMode blockMode_;
 
     /// timeout for DIMSE operations
-    int dimse_timeout_;
+    OFTimeValue dimse_timeout_;
 
 };
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrptb.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrptb.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrptb.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrptb.cc	2017-12-18 09:58:09.107054138 +0100
@@ -41,7 +41,7 @@
     const char *callingAETitle,
     const char *calledAETitle,
     int processId,
-    time_t startTime,
+    OFTimeValue startTime,
     OFBool hasStorageAbility);
 
   /// destructor
@@ -74,7 +74,7 @@
     int      processId_;
 
     /// time the child process was started
-    time_t   startTime_;
+    OFTimeValue   startTime_;
 
     /// true if the child process is allowed to store
     OFBool   hasStorageAbility_;
@@ -86,7 +86,7 @@
       const char *callingAETitle,
       const char *calledAETitle,
       int processId,
-      time_t startTime,
+      OFTimeValue startTime,
       OFBool hasStorageAbility)
 : peerName_()
 , callingAETitle_()
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrsrv.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrsrv.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrsrv.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrsrv.cc	2017-12-18 09:57:18.503392064 +0100
@@ -964,7 +964,7 @@
 #endif
     T_ASC_Association  *assoc;
     char                buf[BUFSIZ];
-    int timeout;
+    OFTimeValue timeout;
     OFBool go_cleanup = OFFalse;
 
     if (options_.singleProcess_) timeout = 1000;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrtis.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrtis.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmqrdb/libsrc/dcmqrtis.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmqrdb/libsrc/dcmqrtis.cc	2017-12-18 09:57:08.706208984 +0100
@@ -1738,7 +1738,7 @@
     return (access(path, R_OK) == 0);
 }
 
-time_t DcmQueryRetrieveTelnetInitiator::TI_dbModifyTime(const char *dbTitle)
+OFTimeValue DcmQueryRetrieveTelnetInitiator::TI_dbModifyTime(const char *dbTitle)
 {
     char path[MAXPATHLEN+1];
     struct stat s;
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmtls/include/dcmtk/dcmtls/tlstrans.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmtls/include/dcmtk/dcmtls/tlstrans.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmtls/include/dcmtk/dcmtls/tlstrans.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmtls/include/dcmtk/dcmtls/tlstrans.h	2017-12-18 09:58:23.518984616 +0100
@@ -118,7 +118,7 @@
    *     If this parameter is 0, the function does not block.
    *  @returns OFTrue if data is available, OFFalse otherwise.
    */
-  virtual OFBool networkDataAvailable(int timeout);
+  virtual OFBool networkDataAvailable(OFTimeValue timeout);
 
   /** returns OFTrue if this connection is a transparent TCP connection,
    *  OFFalse if the connection is a secure connection.
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmtls/libsrc/tlstrans.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmtls/libsrc/tlstrans.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmtls/libsrc/tlstrans.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmtls/libsrc/tlstrans.cc	2017-12-18 09:52:46.808387491 +0100
@@ -248,7 +248,7 @@
   return result;
 }
 
-OFBool DcmTLSConnection::networkDataAvailable(int timeout)
+OFBool DcmTLSConnection::networkDataAvailable(OFTimeValue timeout)
 {
   /* this is an approximation since SSL_pending does not support
    * waiting with a timeout. We first check SSL_pending and then
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/apps/wlcefs.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/apps/wlcefs.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/apps/wlcefs.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/apps/wlcefs.cc	2017-12-18 09:53:25.076679343 +0100
@@ -279,14 +279,14 @@
     {
       OFCmdSignedInt opt_timeout = 0;
       app->checkValue(cmd->getValueAndCheckMin(opt_timeout, 1));
-      opt_acse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_acse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
     }
 
     if (cmd->findOption("--dimse-timeout"))
     {
       OFCmdSignedInt opt_timeout = 0;
       app->checkValue(cmd->getValueAndCheckMin(opt_timeout, 1));
-      opt_dimse_timeout = OFstatic_cast(int, opt_timeout);
+      opt_dimse_timeout = OFstatic_cast(OFTimeValue, opt_timeout);
       opt_blockMode = DIMSE_NONBLOCKING;
     }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/apps/wlcefs.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/apps/wlcefs.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/apps/wlcefs.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/apps/wlcefs.h	2017-12-18 09:53:28.928494410 +0100
@@ -71,9 +71,9 @@
     /// blocking mode for DIMSE operations
     T_DIMSE_BlockingMode opt_blockMode;
     /// timeout for DIMSE operations
-    int opt_dimse_timeout;
+    OFTimeValue opt_dimse_timeout;
     /// timeout for ACSE operations
-    int opt_acse_timeout;
+    OFTimeValue opt_acse_timeout;
     /// instance of console application class (for handling command line arguments)
     OFConsoleApplication *app;
     /// instance of command line class (for handling command line arguments)
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/include/dcmtk/dcmwlm/wlmactmg.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/include/dcmtk/dcmwlm/wlmactmg.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/include/dcmtk/dcmwlm/wlmactmg.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/include/dcmtk/dcmwlm/wlmactmg.h	2017-12-18 09:58:51.777425996 +0100
@@ -70,9 +70,9 @@
     /// blocking mode for DIMSE operations
     T_DIMSE_BlockingMode opt_blockMode;
     /// timeout for DIMSE operations
-    int opt_dimse_timeout;
+    OFTimeValue opt_dimse_timeout;
     /// timeout for ACSE operations
-    int opt_acse_timeout;
+    OFTimeValue opt_acse_timeout;
     /// array of supported abstract syntaxes
     char **supportedAbstractSyntaxes;
     /// number of array fields
@@ -197,8 +197,8 @@
         OFBool opt_singleProcessv, 
         int opt_maxAssociationsv, 
         T_DIMSE_BlockingMode opt_blockModev,
-        int opt_dimse_timeoutv,
-        int opt_acse_timeoutv,
+        OFTimeValue opt_dimse_timeoutv,
+        OFTimeValue opt_acse_timeoutv,
         OFBool opt_forkedChild = OFFalse,
         int argcv = 0,
         char *argvv[] = NULL );
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/include/dcmtk/dcmwlm/wltypdef.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/include/dcmtk/dcmwlm/wltypdef.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/include/dcmtk/dcmwlm/wltypdef.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/include/dcmtk/dcmwlm/wltypdef.h	2017-12-18 09:58:32.233595586 +0100
@@ -84,7 +84,7 @@
   /// process id
   int processId;
   /// start time
-  time_t startTime;
+  OFTimeValue startTime;
   /// indicator if process has storage ability
   OFBool hasStorageAbility;
 };
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/libsrc/wlmactmg.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/libsrc/wlmactmg.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/dcmwlm/libsrc/wlmactmg.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/dcmwlm/libsrc/wlmactmg.cc	2017-12-18 09:53:26.355348910 +0100
@@ -94,8 +94,8 @@
     OFBool opt_singleProcessv,
     int opt_maxAssociationsv,
     T_DIMSE_BlockingMode opt_blockModev,
-    int opt_dimse_timeoutv,
-    int opt_acse_timeoutv,
+    OFTimeValue opt_dimse_timeoutv,
+    OFTimeValue opt_acse_timeoutv,
     OFBool opt_forkedChildv,
     int argcv,
     char *argvv[] )
@@ -327,7 +327,7 @@
 {
   T_ASC_Association *assoc = NULL;
   char buf[BUFSIZ];
-  int timeout;
+  OFTimeValue timeout;
 
   // Depending on if the execution is limited to one single process
   // or not we need to set the timeout value correspondingly.
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/oflog/include/dcmtk/oflog/helpers/timehelp.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/include/dcmtk/oflog/helpers/timehelp.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/oflog/include/dcmtk/oflog/helpers/timehelp.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/include/dcmtk/oflog/helpers/timehelp.h	2017-12-18 10:41:40.412138866 +0100
@@ -57,8 +57,8 @@
 class DCMTK_LOG4CPLUS_EXPORT Time {
 public:
     Time();
-    Time(time_t tv_sec, long tv_usec);
-    explicit Time(time_t time);
+    Time(OFTimeValue tv_sec, long tv_usec);
+    explicit Time(OFTimeValue time);
 
     /**
      * Returns the current time using the <code>gettimeofday()</code>
@@ -71,7 +71,7 @@
     /**
      * Returns <i>seconds</i> value.
      */
-    time_t sec() const { return tv_sec; }
+    OFTimeValue sec() const { return tv_sec; }
 
     /**
      * Returns <i>microseconds</i> value.
@@ -81,7 +81,7 @@
     /**
      * Sets the <i>seconds</i> value.
      */
-    void sec(time_t s) { tv_sec = s; }
+    void sec(OFTimeValue s) { tv_sec = s; }
 
     /**
      * Sets the <i>microseconds</i> value.
@@ -91,12 +91,12 @@
     /**
      * Sets this Time using the <code>mktime</code> function.
      */
-    time_t setTime(tm* t);
+    OFTimeValue setTime(tm* t);
 
     /**
-     * Returns this Time as a <code>time_t</code> value.
+     * Returns this Time as a <code>OFTimeValue</code> value.
      */
-    time_t getTime() const DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
+    OFTimeValue getTime() const DCMTK_LOG4CPLUS_ATTRIBUTE_PURE;
 
     /**
      * Populates <code>tm</code> using the <code>gmtime()</code>
@@ -134,7 +134,7 @@
 
 private:
   // Data
-    time_t tv_sec;  /* seconds */
+    OFTimeValue tv_sec;  /* seconds */
     long tv_usec;  /* microseconds */
 };
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/oflog/libsrc/layout.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/libsrc/layout.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/oflog/libsrc/layout.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/libsrc/layout.cc	2017-12-18 09:53:23.553452824 +0100
@@ -43,7 +43,7 @@
     helpers::Time const rel_time
         = event.getTimestamp () - getTTCCLayoutTimeBase ();
     tchar const old_fill = output.fill ();
-    time_t const sec = rel_time.sec ();
+    OFTimeValue const sec = rel_time.sec ();
  
     if (sec != 0)
         output << sec << STD_NAMESPACE setfill (DCMTK_LOG4CPLUS_TEXT ('0')) << STD_NAMESPACE setw (3);
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/oflog/libsrc/timehelp.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/libsrc/timehelp.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/oflog/libsrc/timehelp.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/oflog/libsrc/timehelp.cc	2017-12-18 09:53:27.601165279 +0100
@@ -84,7 +84,7 @@
 }
 
 
-Time::Time(time_t tv_sec_, long tv_usec_)
+Time::Time(OFTimeValue tv_sec_, long tv_usec_)
     : tv_sec(tv_sec_)
     , tv_usec(tv_usec_)
 {
@@ -92,7 +92,7 @@
 }
 
 
-Time::Time(time_t time)
+Time::Time(OFTimeValue time)
     : tv_sec(time)
     , tv_usec(0)
 {
@@ -152,10 +152,10 @@
 // Time methods
 //////////////////////////////////////////////////////////////////////////////
 
-time_t
+OFTimeValue
 Time::setTime(tm* t)
 {
-    time_t time = mktime(t);
+    OFTimeValue time = mktime(t);
     if (time != -1)
         tv_sec = time;
 
@@ -163,7 +163,7 @@
 }
 
 
-time_t
+OFTimeValue
 Time::getTime() const
 {
     return tv_sec;
@@ -173,7 +173,7 @@
 void
 Time::gmtime(tm* t) const
 {
-    time_t clock = tv_sec;
+    OFTimeValue clock = tv_sec;
 #if defined (DCMTK_LOG4CPLUS_HAVE_GMTIME_S) && defined (_MSC_VER) && _MSC_VER > 1200
     gmtime_s (t, &clock);
 #elif defined (DCMTK_LOG4CPLUS_HAVE_GMTIME_S) && defined (__BORLANDC__)
@@ -190,7 +190,7 @@
 void
 Time::localtime(tm* t) const
 {
-    time_t clock = tv_sec;
+    OFTimeValue clock = tv_sec;
 #ifdef DCMTK_LOG4CPLUS_NEED_LOCALTIME_R
     ::localtime_r(&clock, t);
 #else
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/ofdate.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/ofdate.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/ofdate.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/ofdate.h	2017-12-18 10:02:27.102533947 +0100
@@ -219,7 +219,7 @@
      *  @param tt current system time (as returned by the time() function )
      *  @return OFTrue if the current system date has been set, OFFalse otherwise
      */
-    OFBool setCurrentDate(const time_t &tt);
+    OFBool setCurrentDate(const OFTimeValue &tt);
 
     /* --- static helper functions --- */
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/oftime.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/oftime.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/oftime.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/oftime.h	2017-12-18 10:03:16.259986077 +0100
@@ -357,7 +357,7 @@
      *  @param tt current system time (as returned by the time() function )
      *  @return OFTrue if the current system time has been set, OFFalse otherwise
      */
-    OFBool setCurrentTime(const time_t &tt);
+    OFBool setCurrentTime(const OFTimeValue &tt);
 
     /* --- static helper functions --- */
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/oftypes.h dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/oftypes.h
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/include/dcmtk/ofstd/oftypes.h	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/include/dcmtk/ofstd/oftypes.h	2017-12-18 09:53:12.597735322 +0100
@@ -43,6 +43,7 @@
 #define OFlonglong long long
 #define OFulonglong unsigned long long
 
+using OFTimeValue = time_t;
 using Sint8 = std::int8_t;
 using Uint8 = std::uint8_t;
 using Sint16 = std::int16_t;
@@ -73,6 +74,8 @@
 #define INCLUDE_CSTDDEF
 #include "dcmtk/ofstd/ofstdinc.h"
 
+typedef time_t          OFTimeValue;
+
 typedef signed char     Sint8;
 typedef unsigned char   Uint8;
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/ofdate.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/ofdate.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/ofdate.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/ofdate.cc	2017-12-18 09:58:17.910752960 +0100
@@ -199,7 +199,7 @@
 }
 
 
-OFBool OFDate::setCurrentDate(const time_t &tt)
+OFBool OFDate::setCurrentDate(const OFTimeValue &tt)
 {
     OFBool status = OFFalse;
 #ifdef HAVE_LOCALTIME_R
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/ofdatime.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/ofdatime.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/ofdatime.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/ofdatime.cc	2017-12-18 09:53:15.876542188 +0100
@@ -196,7 +196,7 @@
 OFBool OFDateTime::setCurrentDateTime()
 {
     /* set current system date and time, use the same "time_t" struct to avoid inconsistencies */
-    time_t tt = time(NULL);
+    OFTimeValue tt = time(NULL);
     return Date.setCurrentDate(tt) && Time.setCurrentTime(tt);
 }
 
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/offname.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/offname.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/offname.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/offname.cc	2017-12-18 09:57:14.155521781 +0100
@@ -33,7 +33,7 @@
 
 BEGIN_EXTERN_C
 #ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>    /* for time_t */
+#include <sys/types.h>    /* for OFTimeValue */
 #endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>    /* for stat() */
diff -Nur dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/oftime.cc dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/oftime.cc
--- dcmtk-for-dcmjp2k-3.6.2-unix/ofstd/libsrc/oftime.cc	2017-07-14 17:41:11.000000000 +0200
+++ dcmtk-for-dcmjp2k-3.6.2-unix.patched/ofstd/libsrc/oftime.cc	2017-12-18 09:57:46.093865599 +0100
@@ -329,7 +329,7 @@
 }
 
 
-OFBool OFTime::setCurrentTime(const time_t &tt)
+OFBool OFTime::setCurrentTime(const OFTimeValue &tt)
 {
     OFBool status = OFFalse;
 #ifdef HAVE_LOCALTIME_R
