boot-timestamps.c revision cf0fbc49e67b55f8d346fc94de28c90113505297
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers This file is part of systemd.
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers Copyright 2012 Lennart Poettering
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers Copyright 2013 Kay Sievers
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers systemd is free software; you can redistribute it and/or modify it
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers under the terms of the GNU Lesser General Public License as published by
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers the Free Software Foundation; either version 2.1 of the License, or
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers (at your option) any later version.
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers systemd is distributed in the hope that it will be useful, but
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers WITHOUT ANY WARRANTY; without even the implied warranty of
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers Lesser General Public License for more details.
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers You should have received a copy of the GNU Lesser General Public License
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers along with systemd; If not, see <http://www.gnu.org/licenses/>.
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sieversint boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
39883f622f392d8579f4428fc5a789a102efbb10Lennart Poettering usec_t x = 0, y = 0, a;
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers if (r < 0) {
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers /* Let's convert this to timestamps where the firmware
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers * began/loader began working. To make this more confusing:
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers * since usec_t is unsigned and the kernel's monotonic clock
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers * begins at kernel initialization we'll actually initialize
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers * the monotonic timestamps here as negative of the actual
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers firmware->realtime = n->realtime > a ? n->realtime - a : 0;
c51d84dc09476d9c06b8aac726220bf3c7d62e8dKay Sievers loader->realtime = n->realtime > a ? n->realtime - a : 0;