16
 ?÷     
# Rmetrics is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# Rmetrics 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 Library General Public License for more details.
#
# You should have received a copy of the GNU Library General
# Public License along with this library; if not, write to the
# Free Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA

# Copyrights (C)
# for this R-port:
#   1999 - 2007, Diethelm Wuertz, GPL
#   Diethelm Wuertz <wuertz@itp.phys.ethz.ch>
#   info@rmetrics.org
#   www.rmetrics.org
# for the code accessed (or partly included) from other R-ports:
#   see R's copyright and license files
# for the code accessed (or partly included) from contributed R-ports
# and other sources
#   see Rmetrics's copyright file


################################################################################
# FUNCTION:              GENERATION OF TIMEDATE OBJECTS:
#  'timeDate'             S4 Class representation for timeDate objects
#  timeDate               Creates a 'timeDate' object from given dates
#   whichFormat            Returns format string called by timeDate
#   midnightStandard       Corrects for midnight standard called by timeDate
#  .formatFinCenter        Internal called by timeDate
#  timeCalendar           Creates a 'timeDate' object from calendar atoms
#  timeSequence           Creates a regularly spaced 'timeDate' object
#   seq.timeDate           A synonyme function for timeSequence
#  Sys.timeDate           Returns system time as an object of class 'timeDate'
#  is.timeDate            Tests if the object is of class 'timeDate'
# METHODS:               REPRESENTATION OF TIMEDATE OBJECTS:
#  print.timeDate         Prints 'timeDate' object
#  plot.timeDate          Plots 'timeDate' object
#  points.timeDate        Adds points to a 'timeDate' plot
#  lines.timeDate         Adds lines to a 'timeDate' plot
#  summary.timeDate       Summarizes details of a 'timeDate' object
#  format.timeDate        Formats 'timeDate' as ISO conform character string
################################################################################


test.timeDate =
function()
{
    # DW: We should pack this in several test.timeDate.* functions ...

    # Set Financial Center to GMT:
    setRmetricsOptions(myFinCenter = "GMT")
    print(getRmetricsOptions("myFinCenter"))

    # timeDate() Function:
    charvec = paste("2006-01-", c(10, 20, 30), sep = "")
    print(charvec)
    TD = timeDate(charvec)
    print(TD)
    CHARVEC = as.character(TD)
    attr(CHARVEC, "control")<-NULL
    checkIdentical(charvec, CHARVEC)

    # timeDate() Function, continued:
    charvec = paste("2006-01-", c("10 10", "20 10", "30 10"), sep = "")
    target = paste(charvec, ":00:00", sep = "")
    TD = timeDate(charvec)
    print(TD)
    CHARVEC = as.character(TD)
    attr(CHARVEC, "control")<-NULL
    checkIdentical(target, CHARVEC)

    # timeDate() Function, continued:
    charvec = paste("2006-01-", c("10 10:00", "20 10:00", "30 10:00"), sep = "")
    target = paste(charvec, ":00", sep = "")
    print(charvec)
    TD = timeDate(charvec)
    print(TD)
    CHARVEC = as.character(TD)
    attr(CHARVEC, "control")<-NULL
    checkIdentical(target, CHARVEC)

    # YYYYMMDDhhmmss:
    TD = timeDate("20010101")
    print(TD)
    checkIdentical(format(TD), "2001-01-01")
    TD = timeDate("200101010000")
    print(TD)
    checkIdentical(format(TD), "2001-01-01")
    TD = timeDate("20010101000000")
    print(TD)
    checkIdentical(format(TD), "2001-01-01")
    TD = timeDate("200101011600")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 16:00:00")
    TD = timeDate("20010101160000")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 16:00:00")

    # Format Slot Check:
  