Since my last post was time related, why not another? Don’t worry too much about why this is on a Networking Blog even though it has nothing to do with networking. I own this stuff since there’s a lot of technology in CE and not a ton of developers, so we get to cover all sorts of ground. And I’m not inclined to create a “cetime” blog to cover time related functions on CE :).
Once in a while I’m asked on a newsgroup or internally someone wants to use a Unix style “time.h” function for whatever reason. The answer here is sorry, no, this isn’t supported. In order to save resources (both ROM and developer), we decided only to implement Win32 time related functions.
However, it’s not quite that simple. We do ship time.h in %_WINCEROOT%\public\ie\sdk\inc. This because some code we’ve ported from the desktop needs the time related structures, though it obviously can’t use the Unix style functions declared in this file since they’re not implemented anywhere. (The main data structure people use is tm, not to be confused with Toastmasters (which is a wonderful organization by the way).)
This causes problems for developers who are using Intellisense. Intellisense sees the C runtime functions defined in time.h and doesn’t realize that they’re not implemented, so people write code that calls into them and their code compiles but they get link errors. Understandably this is frustrating. The workaround here is obviously not to trust Intellisense for this particular case. For future versions, we’re looking at removing time.h from this source place or at a minimum removing all the Unixy functions like time(), gmtime(), localtime(), etc… so Intellisense doesn’t get confused.
[Author: John Spaith]