[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 525
  • Last Modified:

CTime usage in Window DLL?

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
rocco
Asked:
rocco
1 Solution
 
mbhaktaCommented:
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
 
roccoAuthor Commented:
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
 
krakenCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now