Is there any way to start an application with python and count how much time does it take to completely load,

any idea if I can do it with os.syste, or subprocess.Popen ?

import datetime
print datetime.datetime.now()

shouldnt this be correct

dif = datetime.datetime.now().time() - datetime.datetime("18:56:18.867128")

or what is the correctway ?

well I am on python 2.7

simple example
# Simple Example

import datetime

def first_task():
    count_loop = 0
    while count_loop <> 100000000:
      a = 2**38
      count_loop += 1


def main():
    """ main() = none
    """
    # start time
    start = datetime.datetime.now()
    first_task()

    # end time
    end = datetime.datetime.now()

    # total time taken
    total_time = end - start
    print 'Total_Time: %s' % total_time

if __name__ == '__main__':
    main()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.