Yet Another WebIOPi+
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Macros
Pages
python
webiopi
devices
clock
osrtc.py
Go to the documentation of this file.
1
# Copyright 2014 Andreas Riegg - t-h-i-n-x.net
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
# http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
#
15
# Changelog
16
#
17
# 1.0 2014-09-02 Initial release.
18
#
19
# Usage remarks
20
#
21
# - The driver just uses the system clock as available within standard
22
# Python. As standard Python does not support setting the system time,
23
# this functionality is not available.
24
#
25
# Implementation remarks
26
#
27
# - All __set... methods are not reimplemented, so calling them will lead
28
# to the intended NotImplementedError. Dow uses ISO format (1..7).
29
30
31
from
webiopi.devices.clock
import
Clock
32
from
datetime
import
datetime
33
34
35
class
OsClock
(
Clock
):
36
37
#---------- Class initialisation ----------
38
39
def
__init__
(self):
40
Clock.__init__(self)
41
42
43
#---------- Abstraction framework contracts ----------
44
45
def
__str__
(self):
46
return
"OsClock"
47
48
def
close
(self):
49
return
50
51
52
#---------- Clock abstraction related methods ----------
53
54
def
__getSec__
(self):
55
return
(datetime.now()).second
56
57
def
__getMin__
(self):
58
return
(datetime.now()).minute
59
60
def
__getHrs__
(self):
61
return
(datetime.now()).hour
62
63
def
__getDay__
(self):
64
return
(datetime.now()).day
65
66
def
__getMon__
(self):
67
return
(datetime.now()).month
68
69
def
__getYrs__
(self):
70
return
(datetime.now()).year
71
72
def
__getDow__
(self):
73
return
(datetime.now()).isoweekday()
74
75
76
#---------- Clock default re-implementations ----------
77
78
def
__getDateTime__
(self):
79
return
datetime.now()
80
81
def
__getDate__
(self):
82
return
(datetime.now()).date()
83
84
def
__getTime__
(self):
85
return
(datetime.now()).time()
86
87
webiopi.devices.clock.osrtc.close
def close
Definition:
osrtc.py:48
webiopi.devices.clock.osrtc.__getTime__
def __getTime__
Definition:
osrtc.py:84
webiopi.devices.clock.osrtc.__init__
def __init__
Definition:
osrtc.py:39
webiopi.devices.clock.osrtc.__getDateTime__
def __getDateTime__
Definition:
osrtc.py:78
webiopi.devices.clock.osrtc.__getDow__
def __getDow__
Definition:
osrtc.py:72
webiopi.devices.clock.Clock
Definition:
__init__.py:40
webiopi.devices.clock.osrtc.__getMin__
def __getMin__
Definition:
osrtc.py:57
webiopi.devices.clock.osrtc.__getYrs__
def __getYrs__
Definition:
osrtc.py:69
webiopi.devices.clock.osrtc.__getDate__
def __getDate__
Definition:
osrtc.py:81
webiopi.devices.clock.osrtc.__getSec__
def __getSec__
Definition:
osrtc.py:54
webiopi.devices.clock.osrtc.__str__
def __str__
Definition:
osrtc.py:45
webiopi.devices.clock.osrtc.OsClock
Definition:
osrtc.py:35
webiopi.devices.clock.osrtc.__getDay__
def __getDay__
Definition:
osrtc.py:63
webiopi.devices.clock.osrtc.__getMon__
def __getMon__
Definition:
osrtc.py:66
webiopi.devices.clock
Definition:
__init__.py:1
webiopi.devices.clock.osrtc.__getHrs__
def __getHrs__
Definition:
osrtc.py:60
Generated on Sat Sep 10 2016 09:37:00 for Yet Another WebIOPi+ by
1.8.8