[edk2-devel] [PATCH v1 1/1] BaseTools/Ecc: Replace deprecated function time.clock()

Philippe Mathieu-Daudé philmd at redhat.com
Thu May 14 07:18:16 UTC 2020


Hi Michael,

On 5/9/20 4:22 AM, Michael Kubacki wrote:
> From: Michael Kubacki <michael.kubacki at microsoft.com>
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2707
> 
> Ecc fails with Python 3.8 because it uses the deprecated time.clock()
> function - https://docs.python.org/3.7/library/time.html#time.clock
> 
> This change updates EccMain.py to use time.perf_counter().
> 
> Cc: Bob Feng <bob.c.feng at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
> ---
>   BaseTools/Source/Python/Ecc/EccMain.py | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Ecc/EccMain.py b/BaseTools/Source/Python/Ecc/EccMain.py
> index 560bb9fd7a31..72edbea3b883 100644
> --- a/BaseTools/Source/Python/Ecc/EccMain.py
> +++ b/BaseTools/Source/Python/Ecc/EccMain.py
> @@ -2,6 +2,7 @@
>   # This file is used to be the main entrance of ECC tool
>   #
>   # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>

You forgot the year: 2020.

With it updated:
Reviewed-by: Philippe Mathieu-Daude <philmd at redhat.com>

>   # SPDX-License-Identifier: BSD-2-Clause-Patent
>   #
>   
> @@ -406,9 +407,9 @@ if __name__ == '__main__':
>       EdkLogger.Initialize()
>       EdkLogger.IsRaiseError = False
>   
> -    StartTime = time.clock()
> +    StartTime = time.perf_counter()
>       Ecc = Ecc()
> -    FinishTime = time.clock()
> +    FinishTime = time.perf_counter()
>   
>       BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime))))
>       EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration))
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59498): https://edk2.groups.io/g/devel/message/59498
Mute This Topic: https://groups.io/mt/74088729/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list