import  math
__author__ = 'pwalker'

def formatTimeStamp(sec):
    c=''
    if sec < 0:
       c = '-'
    sec = abs(sec)
    milliseconds = (sec - math.floor(sec))*1000
    m,s=divmod(sec,60)
    h,m=divmod(m,60)
    if c :
        str  = "-%i:%02i:%02i:%03i" % (h, m, s,milliseconds)
        return  str
    str  = "%i:%02i:%02i:%03i" % (h, m, s,milliseconds)
    return  str
