VMware vSphere

 View Only
  • 1.  Get time in milliseconds or nanoseconds

    Posted Jul 06, 2012 02:34 AM

    Hi,

    In Linux we can use the command: "date +%T+%N" to get the time in nanoseconds. This command does not seem to be working in ESXi's SSH shell.

    Is there any other solution for getting the time in high precision?

    I am doing some experiments that's why I need this accuracy.

    Thanks,

    Ali



  • 2.  RE: Get time in milliseconds or nanoseconds
    Best Answer

    Broadcom Employee
    Posted Jul 06, 2012 05:32 AM

    The "date" command found on ESXi is not the same as your normal GNU date command, it's from Busybox.

    However, you could get use python to get higher precision.

    #!/bin/python

    import time

    print "%.20f" % time.time()

    ~ # date +%s
    1341218714


    ~ # ./getTime.py
    1341218718.30932903289794921875

    Just out of curiosity, what type of experiments are you doing within the ESXi Shell that has these requirements?



  • 3.  RE: Get time in milliseconds or nanoseconds

    Posted Jul 09, 2012 01:44 AM

    Thanks for the answer.

    Actually I am doing some experiments with VMware HA, so I just want to have the time of doing stuff in ESXi shell like kill the VM process.