Meeting.py

From PeformIQ Upgrade
Revision as of 17:12, 19 July 2009 by PeterHarding (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source

Script to generate randomized meeting times for data input to a LoadRunner script.

#!/usr/bin/env python
#
#   $Id:$
#
#---------------------------------------------------------------------

import sys

from random import randint

#---------------------------------------------------------------------

def event():
   duration    = randint(1,30)
   s_duration  = '%02d:%02d' %  (duration / 60, duration % 60)

   t_start     = randint(0,204) * 5
   s_start     = '%02d:%02d' %  (t_start / 60, t_start % 60)

   t_end       = t_start + duration
   s_end       = '%02d:%02d' %  (t_end / 60, t_end % 60)

   return '%s,%s,%s' % (s_start, s_end, s_duration)

#---------------------------------------------------------------------

def main():
   print "StartTime,EndTime,Duration"

   for i in range(500):
      print event()

#---------------------------------------------------------------------

main()

#---------------------------------------------------------------------