timedate

package
v0.0.0-...-c5429dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	*loader.ModuleBase
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon(logger *log.Logger) *Daemon

func (*Daemon) GetDependencies

func (d *Daemon) GetDependencies() []string

func (*Daemon) Start

func (d *Daemon) Start() error

Start to run time date manager

func (*Daemon) Stop

func (d *Daemon) Stop() error

Stop the time date manager

type Manager

type Manager struct {
	PropsMu sync.RWMutex
	// Whether can use NTP service
	CanNTP bool
	// Whether enable NTP service
	NTP bool
	// Whether set RTC to Local standard
	LocalRTC bool

	// Current timezone
	Timezone  string `prop:"access:rw"`
	NTPServer string `prop:"access:rw"`

	// dbusutil-gen: ignore-below
	// Use 24 hour format to display time
	Use24HourFormat bool `prop:"access:rw"`
	// DST offset
	DSTOffset int32 `prop:"access:rw"`
	// User added timezone list
	UserTimezones []string

	// weekday shows format
	WeekdayFormat int32 `prop:"access:rw"`

	// short date shows format
	ShortDateFormat int32 `prop:"access:rw"`

	// long date shows format
	LongDateFormat int32 `prop:"access:rw"`

	// short time shows format
	ShortTimeFormat int32 `prop:"access:rw"`

	// long time shows format
	LongTimeFormat int32 `prop:"access:rw"`

	WeekBegins int32 `prop:"access:rw"`
	// contains filtered or unexported fields
}

Manage time settings

func NewManager

func NewManager(service *dbusutil.Service) (*Manager, error)

Create Manager, if create freedesktop timedate1 failed return error

func (*Manager) AddUserTimezone

func (m *Manager) AddUserTimezone(zone string) *dbus.Error

Add the specified time zone to user time zone list.

func (*Manager) DeleteUserTimezone

func (m *Manager) DeleteUserTimezone(zone string) *dbus.Error

Delete the specified time zone from user time zone list.

func (*Manager) GetExportedMethods

func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods

func (*Manager) GetInterfaceName

func (*Manager) GetInterfaceName() string

func (*Manager) GetSampleNTPServers

func (m *Manager) GetSampleNTPServers() (servers []string, busErr *dbus.Error)

func (*Manager) GetZoneInfo

func (m *Manager) GetZoneInfo(zone string) (zoneInfo zoneinfo.ZoneInfo, busErr *dbus.Error)

GetZoneInfo returns the information of the specified time zone.

func (*Manager) GetZoneList

func (m *Manager) GetZoneList() (zoneList []string, busErr *dbus.Error)

GetZoneList returns all the valid timezones.

func (*Manager) Reset

func (m *Manager) Reset() *dbus.Error

func (*Manager) SetDate

func (m *Manager) SetDate(year, month, day, hour, min, sec, nsec int32) *dbus.Error

SetDate Set the system clock to the specified.

The time may be specified in the format '2015' '1' '1' '18' '18' '18' '8'.

func (*Manager) SetLocalRTC

func (m *Manager) SetLocalRTC(localRTC, fixSystem bool) *dbus.Error

To control whether the RTC is the local time or UTC. Standards are divided into: localtime and UTC. UTC standard will automatically adjust the daylight saving time.

实时时间(RTC)是否使用 local 时间标准。时间标准分为 local 和 UTC。 UTC 时间标准会自动根据夏令时而调整系统时间。

localRTC: whether to use local time.

fixSystem: if true, will use the RTC time to adjust the system clock; if false, the system time is written to the RTC taking the new setting into account.

func (*Manager) SetNTP

func (m *Manager) SetNTP(useNTP bool) *dbus.Error

To control whether the system clock is synchronized with the network.

useNTP: if true, enable ntp; else disable

func (*Manager) SetNTPServer

func (m *Manager) SetNTPServer(server string) *dbus.Error

func (*Manager) SetTime

func (m *Manager) SetTime(usec int64, relative bool) *dbus.Error

Set the system clock to the specified.

usec: pass a value of microseconds since 1 Jan 1970 UTC.

relative: if true, the passed usec value will be added to the current system time; if false, the current system time will be set to the passed usec value.

func (*Manager) SetTimezone

func (m *Manager) SetTimezone(zone string) *dbus.Error

Set the system time zone to the specified value. timezones you may parse from /usr/share/zoneinfo/zone.tab.

zone: pass a value like "Asia/Shanghai" to set the timezone.

type ManagerFormat

type ManagerFormat struct {
	PropsMu sync.RWMutex

	// dsg config
	CurrencySymbol         string `prop:"access:rw"`
	PositiveCurrencyFormat string `prop:"access:rw"`
	NegativeCurrencyFormat string `prop:"access:rw"`
	DecimalSymbol          string `prop:"access:rw"`
	DigitGroupingSymbol    string `prop:"access:rw"`
	DigitGrouping          string `prop:"access:rw"`
	// contains filtered or unexported fields
}

Manage format settings

func (*ManagerFormat) GetInterfaceName

func (*ManagerFormat) GetInterfaceName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL