Package Products :: Package ZenModel :: Module ZenDate |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.ZenDate

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  from Globals import Persistent
    12  from DateTime import DateTime
    13  from Products.ZenUtils import Time
    14
    15 -class ZenDate(Persistent):
    16      """
    17      DEPRECATED wraper so that date sets on device don't provoke entire object
    18      store
    19      """
    20
    21 -    def __init__(self, date=None):
    22          self.setDate(date)
    23
    24 -    def setDate(self, date=None):
    25          if date == None: date = DateTime()
    26          if isinstance(date, basestring):
    27              date = DateTime(date)
    28          self.date = date
    29
    30 -    def __float__(self):
    31          return float(self.date)
    32
    33 -    def getDate(self):
    34          return self.date
    35
    36 -    def getString(self):
    37          """Date in format 2006/09/13 12:16:06.000
    38          """
    39          return Time.LocalDateTime(self.date.timeTime())
    40
    41 -    def getStringSecsResolution(self):
    42          """Date in format 2006/09/13 12:16:06
    43          """
    44          return Time.LocalDateTimeSecsResolution(self.date.timeTime())
    45