Just for project, I added a ByRef to the Function ts arg and it made no
difference (since the contents are not being modified). I'm at a loss
on this one. The debug.print calls in the function indicate that the
st structure's MemoryBlock is being properly passed into the MakeTime
function, but mktime always returns a 0.
Anybody see a mistake in either my function definition or Declare
statement?
Tim
--
Tim Jones tjmac at tolisgroup dot com
On Aug 31, 2004, at 2:03 PM, Tim Jones wrote:
Hi Folks,
I've started expanding my UnixTime module to include all of the
various time functions and I've run into one that I can't get to work
- mktime. According to the manpage (and it works in C), the mktime
function takes a tm_struct pointer and returns a long (time_t).
To experiment, I call time() and place the result in a tm MemoryBlock
(which works). I then pass the resulting tm.long(0) to localtime and
I get back a valid tm_struct in the 44 byte tmStruct memoryblock. I
can parse the 11 members of the tmStruct and all of the values are
valid. If I then pass that tmStruct back to mktime, I always get a 0
returned.
Here's my MakeTime function:
Protected Function MakeTime(ts As MemoryBlock) As Integer
Dim s As Integer
Declare Function mktime Lib "/usr/local/libc.dylib" (t As Ptr) As
Integer
Debug.Print "mktime is passed: " + Str(ts.Long(16)) + " " +
Str(ts.Long(12)) + " " + _
Str(ts.Long(8)) + ":" + Str(ts.Long(4)) + ", " + Str(ts.Long(20)
+ 1900)
s = mktime(ts)
Debug.Print "mktime result = " + Format(s, "##")
Return s
End Function
Of course, normally, I'd just return mktime(ts) rather than go through
the assignment, but I'm trying to determine where this is failing.
Also, it's not really failing as a failure on the part of mktime is
supposed to return -1.
Any thoughts?
Tim
--
Tim Jones tjmac at tolisgroup dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|