ManaTools::Shared::TimeZone

Section: User Contributed Perl Documentation (3)
Updated: 2017-07-06
Page Index
 

NAME

ManaTools::Shared::TimeZone - module to manage TimeZone settings  

SYNOPSIS

    my $tz = ManaTools::Shared::TimeZone->new();

 

DESCRIPTION

This module allows to manage time zone settings.  

SUPPORT

You can find documentation for this module with the perldoc command:

perldoc ManaTools::Shared::TimeZone  

AUTHOR

Angelo Naselli <anaselli@linux.it>  

COPYRIGHT and LICENSE

Copyright (C) 2014-2016, Angelo Naselli.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

METHODS

 

new - optional parameters

timezone_prefix

    optional parameter to set the system timezone directory,
    default value is /usr/share/zoneinfo

 

new - optional parameters

ntp_configuration_file

    optional parameter to set the ntp server configuration file,
    it meant to be for testing purpose, do not set or it will
    be considered as configuration file despite of what the ntp
    service is.

 

new - optional parameters

ntp_conf_dir

    optional parameter to set ntp configuration directory,
    default value is /etc/ntp

 

new - optional parameters

ntp_program

    optional parameter to set the ntp program that runs into the
    system, available value are chronyd, ntpd and systemd-timesyncd.

    Default value is evaluate by configuration file found in the
    system, fallback choice is systemd-timesyncd.

 

attribute

ntpServiceConfig

    This RO attribute is a HashRef containing managed ntp
    service as key and related configuration file.

    Allowed actions:
        getNTPServiceConfig => retrieves config file from the
                               given ntp service
        ntpServiceConfigPairs => Key,Value pairs access

 

attribute

ntpServiceList

    This attribute is a ArrayRef containing the sorted list of
    configured NTP service into the system, retrieving info from
    services.

 

new - optional parameters

installer_or_livecd

    To inform the back-end that is working during installer or
    livecd. Useful if Time zone setting and using fix_system
    to use the real time clock (see setLocalRTC and
    writeConfiguration).

 

refreshNTPServiceList

DESCRIPTION

    Refresh the ntpServiceList attribute value, usefull
    if any NTP service has been istalled after having
    instantiated this object

 

get_timezone_prefix

OUTPUT

timezone_prefix: directory in which time zone files are

DESCRIPTION

Return the timezone directory (defualt: /usr/share/zoneinfo)  

getTimeZones

INPUT

    $from_system: if present and its value is not 0 checks into timezone_prefix
                directory and gets the list from there

OUTPUT

    @l: ARRAY containing sorted time zones

DESCRIPTION

    This method returns the available timezones

 

setTimeZone

INPUT

    $new_time_zone: New time zone to be set

DESCRIPTION

    This method get the new time zone to set and performs
    the setting

 

getTimeZone

OUTPUT

    $timezone: current time zone

DESCRIPTION

    This method returns the current timezone setting

 

setLocalRTC

INPUT

    $enable: bool value enable/disable real time clock as
             localtime
    $fix_system: bool read or not the real time clock

DESCRIPTION

    This method enables/disables the real time clock as
    localtime (e.g. disable means set the rtc to UTC).
    NOTE from dbus:
    Use SetLocalRTC() to control whether the RTC is in
    local time or UTC. It is strongly recommended to maintain
    the RTC in UTC. Some OSes (Windows) however maintain the
    RTC in local time which might make it necessary to enable
    this feature. However, this creates various problems as
    daylight changes might be missed. If fix_system is passed
    "true" the time from the RTC is read again and the system
    clock adjusted according to the new setting.
    If fix_system is passed "false" the system time is written
    to the RTC taking the new setting into account.
    Use fix_system=true in installers and livecds where the
    RTC is probably more reliable than the system time.
    Use fix_system=false in configuration UIs that are run during
    normal operation and where the system clock is probably more
    reliable than the RTC.

 

getLocalRTC

OUTPUT

    $localRTC: 1 if RTC is localtime 0 for UTC

DESCRIPTION

    This method returns the RTC localtime setting

 

setEmbeddedNTP

INPUT

    $enable: enable/disable systemd NTP service

DESCRIPTION

    This method enables/disables and starts/stops systemd NTP service,

 

getEmbeddedNTP

OUTPUT

    $NTP: if systemd NTP is enabled

DESCRIPTION

    This method returns the systemd NTP service is running

 

setTime

INPUT

    $sec_since_epoch: Time in seconds since 1/1/1970

DESCRIPTION

    This method set the system time and sets the RTC also

 

readConfiguration

OUTPUT

    hash reference containing:
        UTC  => HW clock is set as UTC
        ZONE => Time Zone set

DESCRIPTION

    This method returns the time zone system settings as hash
    reference

 

writeConfiguration

INPUT

    $info: hash containing:
           UTC  => HW clock is set as UTC
           ZONE => Time Zone

DESCRIPTION

    This method sets the passed Time Zone configuration.
    If installer_or_livecd attribute is set fix_system is
    passed to setLocalRTC

 

ntpServers

OUTPUT

 HASHREF containing ntp_server => zone info

DESCRIPTION

 This method returns an hash ref containing pairs ntp-server, zone

 

ntpCurrentServers

OUTPUT

    @servers: array of configured server

DESCRIPTION

    Returns the current ntp server address list read from configuration file

 

currentNTPService

DESCRIPTION

    Returns the current ntp service

 

isNTPRunning

DESCRIPTION

   This method just returns if the given ntp server is running

 

setNTPConfiguration

INPUT

    $NTP_servers: HASH reference containing:
        servers => Array reference containing NTP server addresses
        pool    => ntp pool address if any

DESCRIPTION

    This method writes into NTP configuration file new server address
    settings (note that root rights are required) or it rises an
    exception

 

enableAndStartNTP

INPUT

    $server: server address to be configured

DESCRIPTION

    This method writes into NTP configuration file new server address
    settings

 

disableAndStopNTP

DESCRIPTION

    Disable and stop the ntp server


 

Index

NAME
SYNOPSIS
DESCRIPTION
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
METHODS
new - optional parameters
new - optional parameters
new - optional parameters
new - optional parameters
attribute
attribute
new - optional parameters
refreshNTPServiceList
get_timezone_prefix
getTimeZones
setTimeZone
getTimeZone
setLocalRTC
getLocalRTC
setEmbeddedNTP
getEmbeddedNTP
setTime
readConfiguration
writeConfiguration
ntpServers
ntpCurrentServers
currentNTPService
isNTPRunning
setNTPConfiguration
enableAndStartNTP
disableAndStopNTP
LinuxReviews : manual page archive : man3pm