Jim Lawrence
accessd at shaw.ca
Fri Mar 23 13:51:22 CDT 2007
Hi Mark: Excellent research and cracking. Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte Sent: Friday, March 23, 2007 10:24 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] UNIX time. Was: Crack Code Thanks for the code and compliments. After I found the OBJID to be a six character alpha numeric representing the number of seconds past UNIX time(epoch?)...and that they used a 36 base counting system...below is the function I created. (tblKey is a table with 2 columns...the 36 char and their values) Function DeCode(OBJID As String) Dim P_One Dim P_Two Dim P_Three Dim P_Four Dim P_Five Dim P_Six P_One = Left(OBJID, 1) P_Two = Mid(OBJID, 2, 1) P_Three = Mid(OBJID, 3, 1) P_Four = Mid(OBJID, 4, 1) P_Five = Mid(OBJID, 5, 1) P_Six = Mid(OBJID, 6, 1) P_One = DLookup("[Val] ", "tblKey", "[char]= '" & P_One & "'") P_Two = DLookup("[Val] ", "tblKey", "[char]= '" & P_Two & "'") P_Three = DLookup("[Val] ", "tblKey", "[char]= '" & P_Three & "'") P_Four = DLookup("[Val] ", "tblKey", "[char]= '" & P_Four & "'") P_Five = DLookup("[Val] ", "tblKey", "[char]= '" & P_Five & "'") P_Six = DLookup("[Val] ", "tblKey", "[char]= '" & P_Six & "'") P_One = P_One * 60466176 P_Two = P_Two * 1679616 P_Three = P_Three * 46656 P_Four = P_Four * 1296 P_Five = P_Five * 36 P_Six = P_Six DeCode = DateAdd("s", (P_One + P_Two + P_Three + P_Four + P_Five + P_Six), #12/31/69 4:00:00 PM#) End Function Any better ideas...please let me know. Thanks, Mark A. Matte >From: "Gustav Brock" <Gustav at cactus.dk> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: <accessd at databaseadvisors.com> >Subject: Re: [AccessD] UNIX time. Was: Crack Code >Date: Fri, 23 Mar 2007 17:45:51 +0100 > >Hi Mark and Matty > >Nice exploration! >Incredible what some did those days to save a few bytes to cut the >diskspace and cost. > >I found a couple of functions for converting to and from UNIX time: > >Public Function DateFromUnix( _ > ByVal dblSeconds As Double, _ > Optional lngLocalTimeBias As Long) _ > As Date > >' Converts UNIX time value to UTC date value. >' Optionally, a local time bias can be specified; >' this must be in minutes with a resolution of 15 minutes. >' >' Examples: >' UTC. dblSeconds: 1000000000, lngLocalTimeBias: 0 >' 2001-09-09 01:46:40 >' CET. dblSeconds: 1000000000, lngLocalTimeBias: -60 >' 2001-09-09 02:46:40 >' >' 2004-03-23. Cactus Data ApS. CPH. > > ' UNIX UTC start time. > Const cdatUnixTimeZero As Date = #1/1/1970# > ' Maximum time bias, 12 hours. > Const clngTimeBiasMax As Long = 12& * 60& > ' Count of seconds of one day. > Const clngSecondsPerDay As Long = 24& * 60& * 60& > > Dim dblDays As Double > Dim dblDaysSeconds As Double > Dim lngSeconds As Long > Dim datTime As Date > > ' Limit intervals for DateAdd to Long to be acceptable. > dblDays = Int(dblSeconds / clngSecondsPerDay) > dblDaysSeconds = dblDays * clngSecondsPerDay > lngSeconds = dblSeconds - dblDaysSeconds > > datTime = DateAdd("d", dblDays, cdatUnixTimeZero) > datTime = DateAdd("s", lngSeconds, datTime) > If lngLocalTimeBias <> 0 Then > If Abs(lngLocalTimeBias) < clngTimeBiasMax Then > datTime = DateAdd("n", -lngLocalTimeBias, datTime) > End If > End If > > DateFromUnix = datTime > >End Function > >Public Function UnixTimeValue( _ > ByVal datTime As Date, _ > Optional ByVal lngLocalTimeBias As Long) _ > As Double > >' Converts UTC date value to UNIX time value. >' Optionally, a local time bias can be specified; >' this must be in minutes with a resolution of 15 minutes. >' >' Examples: >' UTC. datTime: #09/09/2001 01:46:40#, lngLocalTimeBias: 0 >' 1000000000 >' CET. datTime: #09/09/2001 02:46:40#, lngLocalTimeBias: -60 >' 1000000000 >' >' 2004-03-23. Cactus Data ApS. CPH. > > ' UNIX UTC start time. > Const cdatUnixTimeZero As Date = #1/1/1970# > ' Maximum time bias, 12 hours. > Const clngTimeBiasMax As Long = 12& * 60& > > Dim dblSeconds As Double > > If lngLocalTimeBias <> 0 Then > If Abs(lngLocalTimeBias) < clngTimeBiasMax Then > datTime = DateAdd("n", lngLocalTimeBias, datTime) > End If > End If > dblSeconds = DateDiff("s", cdatUnixTimeZero, datTime) > > UnixTimeValue = dblSeconds > >End Function > >Have fun! > >/gustav > > >>> markamatte at hotmail.com 23-03-2007 15:00 >>> >Thanks Marty, > >I found that it is actually counting from UNIX time 1/1/1970 00:00:00 >UTC...which happens to be 12/31/1969 4:00:00 PM in my time zone. it is a >36 >base counting system...and I had to shift my initial logic ove 2 spaces. >You take the following and add all of the results to come up with a single >number...this number is how many seconds have passed since your start time. > > >> > 1st Value*60466176 > >> > 2nd Value*1679616 > >> > 3rd Value*46656 > >> > 4th Value*1296 > >> > 5th Value*36 > >> > 6th Value > >The last 2 are irrelevant when converting back to time...they are there for >when more than 1 record is created in a single second. > >Thanks again, > >Mark A. Matte > > >From: MartyConnelly <martyconnelly at shaw.ca> > >Reply-To: Access Developers discussion and problem > >solving<accessd at databaseadvisors.com> > >To: Access Developers discussion and problem > >solving<accessd at databaseadvisors.com> > >Subject: Re: [AccessD] OT(kinda): Crack Code > >Date: Thu, 22 Mar 2007 18:32:50 -0700 > > > > I played around with this last night and figured out it was based on >some date in 1974 > >with AM and PM being indicated by last two characters and first 6 as >seconds > >from the start date whatever that is, still it seems a little out as to >accuracy > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ i'm making a difference. Make every IM count for the cause of your choice. Join Now. http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im. live.com/messenger/im/home/?source=hmtagline