import time


def make_timestamp(precision=0):
	"""
	Returns timestamp string that represents the current time
	Precision is number of decimal places to add after the seconds
	"""
	#Outputs time stamp in format YYYYMMDD_hhmmss
	t = time.localtime()
	d = time.time()%1 #decimal places. May be needed later
	YYYY = str(t.tm_year)
	MM= str(100+t.tm_mon)[-2:] #pre-pends zeroes where needed
	DD = str(100+t.tm_mday)[-2:]
	hh = str(100+t.tm_hour)[-2:]
	mm = str(100+t.tm_min)[-2:]
	ss = str(100+t.tm_sec)[-2:]
	l=[YYYY,MM,DD,"_",hh,mm,ss]
	if precision<0:
		print("For backwards compatibility, the timestamp will include seconds anyway")
	elif precision>0:
		d = time.time()%1
		d_str=str(d)[2:2+int(round(precision))]
		l.append("_")
		l.append(d_str)
		#timestamp format YYMMDD_hhmmss_dddd with "precision" digits in place of "dddd" 
	return "".join(l)