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

# Source Code for Module Products.ZenModel.ZenDate

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  from Globals import Persistent
    15  from DateTime import DateTime
    16  from Products.ZenUtils import Time
    17
    18 -class ZenDate(Persistent):
    19      """
    20      DEPRECATED wraper so that date sets on device don't provoke entire object
    21      store
    22      """
    23
    24 -    def __init__(self, date=None):
    25          self.setDate(date)
    26
    27 -    def setDate(self, date=None):
    28          if date == None: date = DateTime()
    29          if type(date) == type(''):
    30              date = DateTime(date)
    31          self.date = date
    32
    33 -    def __float__(self):
    34          return float(self.date)
    35
    36 -    def getDate(self):
    37          return self.date
    38
    39 -    def getString(self):
    40          """Date in format 2006/09/13 12:16:06.000
    41          """
    42          return Time.LocalDateTime(self.date.timeTime())
    43
    44 -    def getStringSecsResolution(self):
    45          """Date in format 2006/09/13 12:16:06
    46          """
    47          return Time.LocalDateTimeSecsResolution(self.date.timeTime())
    48