Copy link to clipboard
Copied
I'm trying to authorize user via ldap to see if they are currently 'logged in'.
normal method would be compare login time against current time and require a new login every 4 hours.
my problem is that LDAP time string is huge (ex: 129296092840348948) .. lots of googling leads me to believe this is MS filetime data type (a composite of two 32-bit numbers).
problem is converting it into something usable.. everything I find about converting refers to a MS system call named FileTimeToSystemTime()
has anyone done this in CF?
Copy link to clipboard
Copied
I cannot say I know anything about it. But a quick google suggests there there is a .net function that might be of use: DateTime.FromFileTime
http://bytes.com/topic/net/answers/123957-filetimetosystemtime-dotnet
http://msdn.microsoft.com/en-us/library/system.datetime.fromfiletime.aspx
-Leigh
Copy link to clipboard
Copied
http://bit.ly/bdC4KT
Copy link to clipboard
Copied
Haha. I should have known the time master would have something in his arsenal
Copy link to clipboard
Copied
cfsearching... ya.. I could just do an exec vb script inside the cf code.. yeah.. uh.. ... actually , that was what I found when I was out looking around.. MS has built in functions for doing the conversion.. but its not a CF solution.
PaulH - you've got a lot of good stuff there
I eventually found my answer on a unix forum (after 4 hours of searching and digging thru all the crap) .. and here is the CF solution:
<cffunction name="fileTimeConvert" access="public" output="false">
<cfargument name="timeString" required="true" type="Numeric">
<cfset var result = ''>
<!--- remove last 7 digits: --->
<cfset var myTempTime = Left(arguments.timeString,11)>
<!--- subtract 11644473600, which is seconds from 1601 to 1970 I think --->
<cfset myTempTime = myTempTime -11644473600 >
<!--- myTempTime is now UNIX epoch time, and do dateAdd: --->
<cfset result = DateAdd("s", myTempTime, "January 1 1970 00:00:00")>
Copy link to clipboard
Copied
I was thinking if it was some weird MS specific time, and all else failed, you could always call a .net library from CF. But obviously I did not look into it that deeply Glad you found a simpler solution.
-Leigh
Copy link to clipboard
Copied
actually, I think it is a weird ms-specific thing ... they have a built-in function in VB and C/+ to do the conversions, and I had to dig a long time to figure out what it was. CF was blowing up because it couldn't handle 64-bit integers when I was just trying to do simple math on the values.
Copy link to clipboard
Copied
>> handle 64-bit integers
True. There is the 32-bit limitation.
actually, I think it is a weird ms-specific thing ... they
have a built-in function in VB and C/+ to do the
conversions, and I had to dig a long time to figure out what
it was.
Yeah, it does seem like an ms-specific thing. But by "weird" I was thinking really twisted, complex stuff like the old Office format. Stuff only masochistic people (like the developers at POI) could ever stick with long enough to figure out