#!/usr/bin/env python

import httplib
import time

def current_milli_time():
	return int(round(time.time() * 1000))

def time_request(host, url):
	conn = httplib.HTTPConnection(host)

	t_start = current_milli_time()
	conn.request("GET", url)
	r1 = conn.getresponse()
	t_end = current_milli_time()

	assert(r1.status == 200), "%d isn't 200" % r1.status
	conn.close()

	return t_end - t_start

print time_request("cseweb.ucsd.edu", "/~gmporter/index.html")
