Sha256: 31693426461507ca805bf03164509a50a3dff53279eb40de943ca76a894c793c

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

/**
 * @file
 * Declares utility functions for dealing with time.
 */
#pragma once

#include <string>
#include <ctime>

namespace leatherman { namespace util {

    /**
     * Adds the specified expiry_minutes to the current time and returns
     * the related date time string in UTC format.
     * @return Returns an empty string in case it fails to allocate the buffer.
     */
    std::string get_expiry_datetime(int expiry_minutes = 1);

    /**
     * Gets the current time in ISO8601 format
     * @param modifier_in_secords Offset from the current time in seconds
     * @return Returns the current time plus the modifier
     */
    std::string get_ISO8601_time(unsigned int modifier_in_seconds = 0);

    /** @return Returns the current datetime string in the %Y%m%d_%H%M%S format */
    std::string get_date_time();

    /**
     * Turns a stored time into a local time with correction for timezones.
     *  @param stored_time The time to be converted.
     *  @param result The struct in which to store the local time.
     */
    void get_local_time(std::time_t* stored_time, std::tm* result);

}}  // namespace leatherman::util

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.12.1.cfacter.20181031 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.6.cfacter.20181031 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.12.1.cfacter.20181023 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.5.cfacter.20181022 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.12.0.cfacter.20181004 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.12.0.cfacter.20181001 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.12.0.cfacter.20180918 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.4.cfacter.20180821 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.3.cfacter.20180716 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.2.cfacter.20180612 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.9.6.cfacter.20180612 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.2.cfacter.20180606 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.9.6.cfacter.20180606 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
facter-3.11.0.cfacter.20180319 ext/facter/leatherman/util/inc/leatherman/util/time.hpp
cfacter-3.11.0.rc.20180314 ext/facter/leatherman/util/inc/leatherman/util/time.hpp