?
Solved

CTime usage in Window DLL?

Posted on 1997-07-19
3
Medium Priority
?
520 Views
Last Modified: 2013-11-20
According to the documentation on CTime, because
CTime uses strftime(), it is not supported in Windows
DLLs. Is this limitation restricted to 16-bit DLLs?
Why this limitation?
0
Comment
Question by:rocco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302685
I have used CTime in 32bit DLL's without any trouble. Iam not aware of this limitation under 16bit DLL's. What are you planning to do with Time in 16bit dll ?
0
 

Author Comment

by:rocco
ID: 1302686
I have no plans in using CTime in a 16-bit DLL, but I want
to make sure that something does not break because I got
lucky that is worked the first time. The documentation
states that I should not use this class in a DLL (it did
not state if 32-bit DLLs are safe). I remember something about
strtok() being unsafe in a medium memory model, but okay in
a large memory model. I am wondering if this special case
exist for strftime().

Thanks...
0
 
LVL 1

Accepted Solution

by:
kraken earned 150 total points
ID: 1302687
The deal with CTime is that strftime() is not re-entrant.  DLLs may be used by many programs at once on the system.  The code's ability to handle many different programs using it at once is known as re-entrancy.  Since strftime() is not re-entrant, you will work fine... maybe... for a while.  Detecting re-entrancy problems is always very difficult, since it has to do with timing and separate processes, sometimes separate applications.

Another major downside to CTime is that it is very limited.  You can't use it for birthdays, for example, because it only extends back to January 1, 1970 (unless, of course, you can guarantee that no one older than 26/27 is going to be stored on your application).

Use COleDateTime instead.  It sounds scarier, but it really isn't.  COleDateTime stores dates as double-precision floating points, and uses a set of specially-designed routines to ensure re-entrancy... and thread-safeness.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question