Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Getting proper TimeDate out of NDS

Keywords:     timedate NDS

Question:

Any ideas on converting TimeDate data after getting the TimeDate data out of NDS.

Sample code listed.


AddExtender("wwn4x34I.dll")

dCONTEXT = AskLine ("Information Handler", "What Context do you wish to Grab User Data from?",
"")

objects = n4ObjectList(dCONTEXT, "", "USER", "")
count = ItemCount(objects, @TAB)
For i = 1 To count
UserID = ItemExtract(i, objects, @TAB)
Tvalue = n4ObjectProps(dCONTEXT, UserID, "Last Login Time")
; Seconds=TimeDiffSecs(TimeYmdHms(), "1980:01:01:00:00:00")
; Message("Seconds from Jan 01, 1980", Seconds)
Now=TimeAdd("1970:01:01:10:00:00","00:00:00:00:00:%Tvalue%")
Message(UserId, Now)
IniWritePvt("Users", UserID, Now, "c:\windows\temp\test.ini")
Next
display (2, "Yes", "Done")
Data with same user logging in and out several times:
[Users]
# UserId NDS data NDS Time Diff
1 dachadwi = 899407965 7/2/98 02:37:20 pm
2 dachadwi = 899408240 7/2/98 02:39:39 pm 275
3 dachadwi = 899408379 7/2/98 02:40:54 pm 138
4 dachadwi = 899408454 7/2/98 02:42:18 pm 75
5 dachadwi = 899408538 7/2/98 02:47:46 pm 84

Answer:

Getting *real* close.

I'm wondering about:

   Now=TimeAdd("1970:01:01:10:00:00","00:00:00:00:00:%Tvalue%")
I can understand the 1/1/1970 part, but what is with the 10:00 AM part. If that is a GMT offset, I think it would be in the middle of the Pacific ocean.

Sort of looks like previous - not current - login time.

Resolution:

You know, You are exactly correct. Windows 95 version of nwadmin displays the Current Login Time as the Last Login Time. If I used nlist user=dachadwi show "last login time" it gave the the last login time before the current login time which was found from nlist user=dachadwi show "login time" which was the time I needed. I looked at all the properties that n4objectlist gave and noticed the two had different values. Novell verified that the values were in seconds from 1/1/1970. All I had to do from there is offset for GMT CENTRAL -6 as 1969:12:31:19:00:00 and wa la fixed. Thanks for the help. I also am including some new code which others may find usefull.
   AddExtender("wwn4x34I.dll")

   P1 = "%PARAM1%"
   IF P1 == "" THEN
      MESSAGE("Syntax Error", "Usage NDSLIST d:\path\filename")
      P1 = "c:\windows\temp\test.ini"
   EndIf
   
   dCONTEXT = AskLine ("Information Handler", "What Context do you wish to Grab User Data from?","")

   :oagain
   CLIST = n4ObjectList(dCONTEXT, "", "", "")
   Object = askitemlist("Select an Object.", CLIST, @TAB, @sorted,@single)
   
   if Object == "" then 
      Message("Information Handler","You must select an object, Try again.")
      goto oagain
   Endif
   
   PROP= n4ObjectProps(dCONTEXT, Object, "")
   Oprop = askitemlist("Select a Property.", PROP, @TAB, @sorted,@single)
   Ovalue = n4ObjectProps(dCONTEXT, Object, Oprop)
   
   if Oprop == "" then 
      count = ItemCount(Ovalue, @TAB)
      
      For I = 1 To count
         Oproperty = ItemExtract(I, Ovalue, @TAB)
         Tvalue = n4ObjectProps(dCONTEXT, Object, Oproperty)
         IniWritePvt(Object, Oproperty, Tvalue, P1)
      Next
      
      Message("Information Handler","Finished gathering information on Object")
   Endif
   
   If Oprop == "" then goto done
   Message(Object, Ovalue)
   IniWritePvt("Object Info", Object, Ovalue, P1)
   :done

Article ID:   W13601
Filename:   Getting Proper TimeDate out of NDS.txt