|
38 |
import string |
38 |
import string |
39 |
import re |
39 |
import re |
40 |
import sys |
40 |
import sys |
|
|
41 |
import calendar |
41 |
import time |
42 |
import time |
42 |
import types |
43 |
import types |
43 |
import pprint |
44 |
import pprint |
Lines 239-250
def encode_s4_resultlist(s4_resultlist):
|
Link Here
|
---|
|
239 |
|
237 |
|
240 |
def unix2s4_time(l): |
238 |
def unix2s4_time(l): |
241 |
d = 116444736000000000 # difference between 1601 and 1970 |
239 |
d = 116444736000000000 # difference between 1601 and 1970 |
242 |
return int(time.mktime(time.gmtime(time.mktime(time.strptime(l, "%Y-%m-%d")) + 90000))) * 10000000 + d # 90000s are one day and one hour |
240 |
return int(calendar.timegm(time.gmtime(calendar.timegm(time.strptime(l, "%Y-%m-%d")) - 86400))) * 10000000 + d # AD stores end of day in accountExpires |
243 |
|
241 |
|
244 |
|
242 |
|
245 |
def s42unix_time(l): |
243 |
def s42unix_time(l): |
246 |
d = 116444736000000000 # difference between 1601 and 1970 |
244 |
d = 116444736000000000 # difference between 1601 and 1970 |
247 |
return time.strftime("%d.%m.%y", time.gmtime((l - d) / 10000000)) |
245 |
return time.strftime("%d.%m.%y", time.gmtime((l - d) / 10000000 + 86400)) # shadowExpire treats day of expiry as exclusive |
248 |
|
246 |
|
249 |
|
247 |
|
250 |
def samba2s4_time(l): |
248 |
def samba2s4_time(l): |