#coding=utf-8
import random
import time
import datetime
TIMESTART = ‘2016-06-04 10:00:01‘
#increase time, string to time, then add seconds you want, at last, time to string
def increaseTime(base_time):
date_time = datetime.datetime.strptime(base_time,‘%Y-%m-%d %H:%M:%S‘) #string to datetime
time_time = time.mktime(date_time.timetuple()) #datetime to timestamp datetime.datetime(2016, 6, 4, 10, 0, 1)
time_time = time_time + 1 #1465005606.0
new_time = time.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime(time_time)) #‘2016-06-04 10:00:06‘
return new_time
def createTimeSet():
time = TIMESTART;
f=open(‘column.txt‘,‘w‘)
for i in range(1,101):
f.write(str(time) + ‘\n‘)
if i%3 == 0:
print i
time=increaseTime(time)
f.close()
macstart = 1;
def increaseMac(macparam):
return (macparam + 1)
def createMacSet():
mac = macstart
f=open(‘mac.txt‘,‘w‘)
for i in range(1,101):
macstr = ‘%012X‘ % mac
macstr = macstr[0]+macstr[1]+‘:‘+ macstr[2]+macstr[3]+‘:‘+macstr[4]+macstr[5]+‘:‘+macstr[6]+macstr[7]+‘:‘+macstr[8]+macstr[9]+‘:‘+macstr[10]+macstr[11]
f.write(macstr + ‘\n‘)
mac=mac+1
if i%3 == 0:
mac=macstart
f.close()
arrX=[]
arrY=[]
def initArrX(length):
for i in range(length):
X = random.randint(0, 1000)
arrX.append(X)
print arrX
def initArrY(length):
for i in range(length):
Y = random.randint(0, 640)
arrY.append(Y)
print arrY
def createXYSet():
initArrX(3)
initArrY(3)
f=open(‘xy.txt‘,‘w‘)
for i in range(0,100):
f.write(str(arrX[i%3]) +‘\n‘)
arrX[i%3] = arrX[i%3] + random.randint(-1, 1)
f.close()
# for i in range(0,100):
# f.write(str(arr[i%3]) +‘\n‘)
# arr[i%3] = arr[i%3] + random.randint(-1, 1)