File: runit.Class.R

package info (click to toggle)
r-cran-timedate 3012.100-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,592 kB
  • ctags: 4
  • sloc: makefile: 13
file content (627 lines) | stat: -rw-r--r-- 20,249 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627

# 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:
    TD = timeDate("2001-01-01")
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d")
    TD = timeDate("2001-01-01 00:00")
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d")
    TD = timeDate("2001-01-01 00:00:00")
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d")
    TD = timeDate("2001-01-01 16:00")
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d %H:%M:%S")
    TD = timeDate("2001-01-01 16:00:00")
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d %H:%M:%S")
    TD = timeDate(c("2001-01-01 00:00", "2001-01-01 16:00"))
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d %H:%M:%S")
    TD = timeDate(c("2001-01-01 00:00:00", "2001-01-01 16:00:00"))
    print(TD)
    checkIdentical(TD@format, "%Y-%m-%d %H:%M:%S")

    # More timeDate Checks:
    TD = timeDate("20010101",
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 01:00:00")
    TD = timeDate("200101010000",
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 01:00:00")
    TD = timeDate("20010101000000",
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 01:00:00")
    TD = timeDate("200101011600",
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 17:00:00")
    TD = timeDate("20010101160000",
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), "2001-01-01 17:00:00")
    TD = timeDate(c("2001-01-01 00:00", "2001-01-01 16:00"),
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), c("2001-01-01 01:00:00", "2001-01-01 17:00:00"))
    TD = timeDate(c("2001-01-01 00:00:00", "2001-01-01 16:00:00"),
        zone = "GMT", FinCenter = "Zurich")
    print(TD)
    checkIdentical(format(TD), c("2001-01-01 01:00:00", "2001-01-01 17:00:00"))

    # Format: "%d-%b-%Y"
    Months = c("Mar", "Jun", "Sep", "Dec")
    charvec <- paste("01", Months, "2006", sep = "-")
    print(TD <- timeDate(charvec, format = "%d-%b-%Y"))
    ## checkIdentical(format(TD),
    ##   paste("2006", c("03-01", "06-01", "09-01", "12-01"), sep = "-"))

    # Format: "%m/%d/%Y"
    print(TD <- timeDate("12/15/2006", format = "%m/%d/%Y"))
    checkIdentical(format(TD), "2006-12-15")

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.whichFormat <-
    function()
{
    # Which Format:
    WF = whichFormat("20010101")
    print(WF)
    checkIdentical(WF, "%Y%m%d")
    WF = whichFormat("200101010000")
    print(WF)
    checkIdentical(WF, "%Y%m%d%H%M")
    WF = whichFormat("20010101000000")
    print(WF)
    checkIdentical(WF, "%Y%m%d%H%M%S")
    WF = whichFormat("200101011600")
    print(WF)
    checkIdentical(WF, "%Y%m%d%H%M")
    WF =  whichFormat("20010101160000")
    print(WF)
    checkIdentical(WF, "%Y%m%d%H%M%S")
    WF =  whichFormat("2001-01-01")
    print(WF)
    checkIdentical(WF, "%Y-%m-%d")
    WF =  whichFormat("2001-01-01 00:00")
    print(WF)
    checkIdentical(WF, "%Y-%m-%d %H:%M")
    WF =  whichFormat("2001-01-01 00:00:00")
    print(WF)
    checkIdentical(WF, "%Y-%m-%d %H:%M:%S")
    WF =  whichFormat("2001-01-01 16:00")
    print(WF)
    checkIdentical(WF, "%Y-%m-%d %H:%M")
    WF =  whichFormat("2001-01-01 16:00:00")
    print(WF)
    checkIdentical(WF, "%Y-%m-%d %H:%M:%S")
    WF =  whichFormat("01/01/2001")
    print(WF)
    checkIdentical(WF, "%m/%d/%Y")
    WF =  whichFormat("01-Jan-2001")
    print(WF)
    checkIdentical(WF, "%d-%b-%Y")

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.midnightStandard <-
    function()
{
    ISOform <- "%Y-%m-%d %H:%M:%S"

    .midAuto <- function(cc)  midnightStandard(cc,  whichFormat(cc))

    # Midnight Standard - Short Form:
    dd <- c("20010101", "20070131")
    dd.iso <- format(as.POSIXlt(strptime(dd, "%Y%m%d")), ISOform)
    print(MS <- .midAuto(dd))
    checkIdentical(MS, dd.iso)

    checkIdentical(dd.iso, .midAuto(c("200101010000", "200701310000")))

    checkIdentical(dd.iso, .midAuto(c("20010101000000", "20070131000000")))

    checkIdentical(dd.iso, .midAuto(c("2001-01-01 00:00:00",
                      "2007-01-31 00:00:00")))

    print(MS <- .midAuto("200101011600"))
    checkIdentical(MS, "2001-01-01 16:00:00")
    checkIdentical(MS, .midAuto("20010101160000"))


    ## midnight case :
    MN <- .midAuto("20010131240000")
    checkIdentical(MN, "2001-02-01 00:00:00")
    checkIdentical(MN, .midAuto(MN))
    checkIdentical(.midAuto("200101312400"), MN)# no seconds
    checkIdentical(.midAuto("2001013124"), MN)# no min., no sec.

    ## NEW: "arbitrary format":
    cv <- c("240000 20010131", "231020 20010131")
    print(MS <-  midnightStandard(cv, (fcv <- "%H%M%S %Y%m%d")))
    checkIdentical(MS, c("2001-02-01 00:00:00", "2001-01-31 23:10:20"))
    print(MS2 <-  midnightStandard2(cv, fcv))
    checkTrue(inherits(MS2, "POSIXct"))
    checkIdentical(MS, format(MS2))

    cv <- c('1/1/2010', '10/10/2010')
    print(MS <-  midnightStandard2(cv)) ## only the *2() version works here!
    checkTrue(inherits(MS, "POSIXct"))
    checkIdentical(format(MS), c("2010-01-01", "2010-10-10"))

    ## even more extreme
    cv <- c("24:00, 31.01.2001", "23:10, 31.01.2001",
            "24:00, 31.12.2005")
    print(MS <-  midnightStandard(cv, "%H:%M, %d.%m.%Y"))
    checkIdentical(MS, c("2001-02-01 00:00:00", "2001-01-31 23:10:00",
             "2006-01-01 00:00:00"))

    # Midnight Standard - Human Readable Form:
    print(MS <- .midAuto("2001-01-31"))

    checkIdentical(MS, "2001-01-31 00:00:00")

    checkIdentical(MS, .midAuto(MS))
    checkIdentical(MS, .midAuto("2001-01-31 00:00"))
    checkIdentical(MS, .midAuto("2001-01-31 00"))

    checkIdentical(MN, .midAuto("2001-01-31 24:00:00"))
    checkIdentical(MN, .midAuto("2001-01-31 24:00"))
    checkIdentical(MN, .midAuto("2001-01-31 24"))

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.POSIX =
function()
{
    # POSIX:
    setRmetricsOptions(myFinCenter = "GMT")
    X = ISOdate(year = 2006, month = 1:12, day = 1, hour = 0)
    print(X)
    print(class(X))
    TD = timeDate(X)
    print(TD)
    current = c(
        "2006-01-01", "2006-02-01", "2006-03-01", "2006-04-01",
        "2006-05-01", "2006-06-01", "2006-07-01", "2006-08-01",
        "2006-09-01", "2006-10-01", "2006-11-01", "2006-12-01")
    print(current)
    checkIdentical(format(TD), current)

    # POSIX, continued:
    X = ISOdate(year = 2006, month = 1:12, day = 1, hour = 0)
    GMT = timeDate(X, zone = "GMT", FinCenter = "GMT")
    print(GMT)
    current = c(
        "2006-01-01", "2006-02-01", "2006-03-01", "2006-04-01",
        "2006-05-01", "2006-06-01", "2006-07-01", "2006-08-01",
        "2006-09-01", "2006-10-01", "2006-11-01", "2006-12-01")
    print(current)
    checkIdentical(format(GMT), current)

    # POSIX, continued:
    NYC = timeDate(X, zone = "NewYork", FinCenter = "NewYork")
    print(NYC)
    current = c(
        "2006-01-01", "2006-02-01", "2006-03-01", "2006-04-01",
        "2006-05-01", "2006-06-01", "2006-07-01", "2006-08-01",
        "2006-09-01", "2006-10-01", "2006-11-01", "2006-12-01")
    print(current)
    checkIdentical(format(NYC), current)

    # POSIX, continued:
    GMT.NYC = timeDate(X, zone = "GMT", FinCenter = "NewYork")
    print(GMT.NYC)
    current = c(
        "2005-12-31 19:00:00", "2006-01-31 19:00:00", "2006-02-28 19:00:00",
        "2006-03-31 19:00:00", "2006-04-30 20:00:00", "2006-05-31 20:00:00",
        "2006-06-30 20:00:00", "2006-07-31 20:00:00", "2006-08-31 20:00:00",
        "2006-09-30 20:00:00", "2006-10-31 19:00:00", "2006-11-30 19:00:00")
    print(current)
    checkIdentical(format(GMT.NYC), current)

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.asTimeDate =
function()
{
    # as.timeDate() Function:
    X = ISOdate(year = 2006, month = 1:12, day = 1, hour = 10)
    GMT = as.timeDate(X, zone = "GMT", FinCenter = "GMT")[c(6, 12)]
    print(GMT)
    current = c("2006-06-01 10:00:00", "2006-12-01 10:00:00")
    print(current)
    checkIdentical(format(GMT), current)

    # as.timeDate() Function, continued:
    X = ISOdate(year = 2006, month = 1:12, day = 1, hour = 10)
    NYC = as.timeDate(X, zone = "NewYork", FinCenter = "NewYork")[c(6, 12)]
    print(NYC)
    current = c("2006-06-01 10:00:00", "2006-12-01 10:00:00")
    print(current)
    checkIdentical(format(NYC), current)

    # as.timeDate() Function, continued:
    X = ISOdate(year = 2006, month = 1:12, day = 1, hour = 10)
    GMT.NYC = as.timeDate(X, zone = "GMT", FinCenter = "NewYork")[c(6, 12)]
    print(GMT.NYC)
    current = c("2006-06-01 06:00:00", "2006-12-01 05:00:00")
    print(current)
    checkIdentical(format(GMT.NYC), current)

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.asDate =
function()
{
    # as.Date() Function:
    X = as.Date(ISOdate(year = 2006, month = 1:12, day = 1, hour = 10))
    GMT = as.timeDate(X, zone = "GMT", FinCenter = "GMT")[c(6, 12)]
    print(GMT)
    current = c("2006-06-01", "2006-12-01")
    print(current)
    checkIdentical(format(GMT), current)

    # as.Date() Function, continued:
    X = as.Date(ISOdate(year = 2006, month = 1:12, day = 1, hour = 10))
    NYC = as.timeDate(X, zone = "NewYork", FinCenter = "NewYork")[c(6, 12)]
    print(NYC)
    current = c("2006-06-01", "2006-12-01")
    print(current)
    checkIdentical(format(NYC), current)

###     # FIXME: YC, IMO the test case is wrong,
###     # i.e. current =  c("2006-05-31 20:00:00", "2006-11-30 19:00:00")
###     # as.Date() Function, continued:
###     X = as.Date(ISOdate(year = 2006, month = 1:12, day = 1, hour = 10))
###     GMT.NYC = as.timeDate(X, zone = "GMT", FinCenter = "NewYork")[c(6, 12)]
###     print(GMT.NYC)
###     current = c("2006-06-01", "2006-12-01")
###     print(current)
###     checkIdentical(format(GMT.NYC), current)

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.timeCalendar =
function()
{
    # timeCalendar() Function, Check FinCenter:
    setRmetricsOptions(myFinCenter = "Zurich")
    target = as.character(getRmetricsOptions("myFinCenter"))
    target
    current = "Zurich"
    current
    checkIdentical(target, current)

    # timeCalendar() Function, Check CurrentYear:
    target = as.character(getRmetricsOptions("currentYear"))
    target
    current = substr(as.character(Sys.Date()), 1, 4)
    current
    checkIdentical(target, current)

    # timeCalendar() | timeSequence() Functions:
    # Generate timDate from timeCalendar, compare with timeSequence
    setRmetricsOptions(myFinCenter = "GMT")
    target = timeCalendar(y = 2006, m = 1:12, d = 1)
    target
    current = timeSequence(from = "2006-01-01", by = "month", length.out = 12)
    current
    checkIdentical(target, current)

    # timeCalendar() | timeSequence() Functions:
    # Generate timDate from timeCalendar, compare with timeSequence:
    setRmetricsOptions(myFinCenter = "Zurich")
    target = timeCalendar(y = 2006, m = 1:12, d = 1)
    target
    current = timeSequence(from = "2006-01-01", by = "month", length.out = 12)
    current
    checkIdentical(target, current)

    # timeCalendar() Function:
    # Date/Time:
    setRmetricsOptions(myFinCenter = "Zurich")
    ZRH.ZRH = timeCalendar(h = 16)
    GMT.ZRH = timeCalendar(h = 16, zone = "GMT")
    GMT.NYC = timeCalendar(h = 16, zone = "GMT", FinCenter = "NewYork")
    checkEqualsNumeric(target = sum(as.integer(ZRH.ZRH-GMT.ZRH)), -19)
    checkEqualsNumeric(target = sum(as.integer(GMT.ZRH-GMT.NYC)),   0)
    checkEqualsNumeric(target = sum(as.integer(GMT.NYC-ZRH.ZRH)), +19)

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.timeSequence =
function()
{
    # timeCalendar -
    # Generate timDate Objects from Sequences:
    getRmetricsOptions("myFinCenter")
    target = timeSequence(from = "2006-01-01", to = "2006-01-31", by = "day")
    target
    current = timeCalendar(y = 2006, m = 1, d = 1:31)
    current
    checkIdentical(target, current)

    # By Hour:
    from = "2006-01-01 00:00:00"
    to   = "2006-01-01 23:59:59"
    timeSequence(from, to, by = "hour")

    # By Minute:
    from = "2006-01-01 16:00:00"
    to   = "2006-01-01 16:14:59"
    timeSequence(from, to, by = "min")

    # By Second:
    from = "2006-01-01 16:00:00"
    to   = "2006-01-01 16:00:14"
    timeSequence(from, to, by = "s")

    # Check length.out - hourly timeDates:
    from = "2006-01-01 16:00:00"
    timeSequence(from, length.out = 15, by = "year")
    timeSequence(from, length.out = 15, by = "quarter")
    timeSequence(from, length.out = 15, by = "week")
    timeSequence(from, length.out = 15, by = "month")
    timeSequence(from, length.out = 15, by = "day")
    timeSequence(from, length.out = 15, by = "hour")
    timeSequence(from, length.out = 15, by = "min")
    timeSequence(from, length.out = 15, by = "sec")

    # Check length.out - Dates:
    from = "2006-01-01"
    timeSequence(from, length.out = 15, by = "year")
    timeSequence(from, length.out = 15, by = "quarter")
    timeSequence(from, length.out = 15, by = "week")
    timeSequence(from, length.out = 15, by = "month")
    timeSequence(from, length.out = 15, by = "day")
    timeSequence(from, length.out = 15, by = "hour")
    timeSequence(from, length.out = 15, by = "min")
    timeSequence(from, length.out = 15, by = "sec")

    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.sysTimeDate =
function()
{
    # Check Financieal Center:
    setRmetricsOptions(myFinCenter = "Zurich")
    checkIdentical(as.character(getRmetricsOptions("myFinCenter")), "Zurich")

    # Zurich:
    ZRH = Sys.timeDate()
    print(ZRH)

    # GMT:
    GMT = Sys.timeDate("GMT")
    print(GMT)

    # New York:
    NYC = Sys.timeDate("NewYork")
    print(NYC)

    # Check Class of Sys.timeDate()
    CLASS = class(Sys.timeDate())
    print(CLASS)
    checkIdentical(CLASS[[1]], "timeDate")

    # Check Class of Sys.Date()
    CLASS = class(Sys.Date())
    print(CLASS)
    checkIdentical(CLASS[[1]], "Date")

    # Compare timeDate() and as.timeDate() from Date object:
    DATE = Sys.Date()
    TD1 = timeDate(DATE, zone = "NewYork", FinCenter = "Zurich")
    TD2 = as.timeDate(DATE, zone = "NewYork", FinCenter = "Zurich")
    checkIdentical(target = TD1, current = TD2)


    # Return Value:
    return()
}


# ------------------------------------------------------------------------------


test.displayMethods =
function()
{
    #  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

    # Check Financieal Center:
    setRmetricsOptions(myFinCenter = "NewYork")
    print(getRmetricsOptions("myFinCenter"))
    checkIdentical(as.character(getRmetricsOptions("myFinCenter")), "NewYork")

    # print() Function
    DT = timeCalendar()
    PRINT = print(DT)
    checkIdentical(PRINT, DT)

    # plot() Function:
    DT = timeSequence("2006-01-01", length.out = 10)
    y = rnorm(10)
    plot(DT, y)
    points(DT, y, col = "red")
    lines(DT, y, col = "blue")

    # summary() Function
    DT = timeCalendar(2006)
    SUMMARY = summary(DT)
    checkIdentical(SUMMARY, DT)

    # format() Function
    FORMAT = format(DT)[7]
    print(FORMAT)
    checkIdentical(FORMAT, "2006-07-01")

    # Return Value:
    return()
}


################################################################################