aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime/benchmark/gmtime_r/main.cpp
blob: a649ab3ccfe11957c0426ec71f81609044cc3491 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <library/cpp/testing/benchmark/bench.h>

#include <util/draft/datetime.h>

Y_CPU_BENCHMARK(GmTimeR, iface) {
    time_t now = TInstant::Now().TimeT();
    struct tm buf {};

    for (size_t i = 0; i < iface.Iterations(); ++i) {
        Y_DO_NOT_OPTIMIZE_AWAY(GmTimeR(&now, &buf));
    }
}

Y_CPU_BENCHMARK(gmtime_r, iface) {
    time_t now = TInstant::Now().TimeT();
    struct tm buf {};

    for (size_t i = 0; i < iface.Iterations(); ++i) {
        Y_DO_NOT_OPTIMIZE_AWAY(gmtime_r(&now, &buf));
    }
}