summaryrefslogtreecommitdiffstats
path: root/kdecore/tests/ktimezonestest.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /kdecore/tests/ktimezonestest.cpp
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'kdecore/tests/ktimezonestest.cpp')
-rw-r--r--kdecore/tests/ktimezonestest.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/kdecore/tests/ktimezonestest.cpp b/kdecore/tests/ktimezonestest.cpp
deleted file mode 100644
index 69ea7c8a1..000000000
--- a/kdecore/tests/ktimezonestest.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "ktimezones.h"
-#include <kapplication.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(int argc, char *argv[])
-{
- KInstance instance("ktimezonestest");
-
- if ((argc==2) && (strcmp(argv[1], "local")==0))
- {
- KTimezones timezones;
-
- // Find the local timezone.
- const KTimezone *timezone = timezones.local();
- printf( "Local timezone: %s\n", timezone->name().latin1() );
-
- // Find the current offset of the UTC timezone.
- timezone = timezones.zone("UTC");
- printf( "UTC timezone offset should be 0: %d\n", timezone->offset(TQDateTime::tqcurrentDateTime()) );
-
- // Find some offsets for Europe/London.
- char *london = "Europe/London";
- timezone = timezones.zone(london);
- TQDateTime winter(TQDateTime::fromString("2005-01-01T00:00:00", Qt::ISODate));
- TQDateTime summer(TQDateTime::fromString("2005-06-01T00:00:00", Qt::ISODate));
- printf( "%s winter timezone offset should be 0: %d\n", london, timezone->offset(winter) );
- printf( "%s summer timezone offset should be 3600: %d\n", london, timezone->offset(summer) );
-
- // Try timezone conversions.
- const KTimezone *losAngeles = timezones.zone("America/Los_Angeles");
- char *bstBeforePdt = "2005-03-28T00:00:00";
- char *bstAfterPdt = "2005-05-01T00:00:00";
- char *gmtBeforePst = "2005-10-30T01:00:00";
- char *gmtAfterPst = "2005-12-01T00:00:00";
- TQString result;
- result = timezone->convert(losAngeles, TQDateTime::fromString(bstBeforePdt, Qt::ISODate)).toString(Qt::ISODate);
- printf( "BST before PDT, %s should be 2005-03-27T15:00:00: %s\n", bstBeforePdt, result.latin1() );
- result = timezone->convert(losAngeles, TQDateTime::fromString(bstAfterPdt, Qt::ISODate)).toString(Qt::ISODate);
- printf( "BST and PDT, %s should be 2005-04-30T16:00:00: %s\n", bstAfterPdt, result.latin1() );
- result = timezone->convert(losAngeles, TQDateTime::fromString(gmtBeforePst, Qt::ISODate)).toString(Qt::ISODate);
- printf( "GMT before PST, %s should be 2005-10-29T17:00:00: %s\n", gmtBeforePst, result.latin1() );
- result = timezone->convert(losAngeles, TQDateTime::fromString(gmtAfterPst, Qt::ISODate)).toString(Qt::ISODate);
- printf( "GMT and PST, %s should be 2005-11-30T16:00:00: %s\n", gmtAfterPst, result.latin1() );
- printf( "Latitude 89 should be valid: %svalid\n", KTimezone::isValidLatitude(89.0) ? "" : "in");
- printf( "Latitude 91 should be invalid: %svalid\n", KTimezone::isValidLatitude(91.0) ? "" : "in");
- printf( "Longitude 179 should be valid: %svalid\n", KTimezone::isValidLongitude(179.0) ? "" : "in");
- printf( "Longitude 181 should be valid: %svalid\n", KTimezone::isValidLongitude(181.0) ? "" : "in");
- return 0;
- }
-
- if ((argc==2) && (strcmp(argv[1], "all")==0))
- {
- KTimezones timezones;
- KTimezones::ZoneMap allZones = timezones.allZones();
- for ( KTimezones::ZoneMap::const_iterator it = allZones.begin(), end = allZones.end(); it != end; ++it )
- printf( "%s\n", it.key().latin1() );
- }
-
- printf( "Usage: ktimezonestest [local|all]!\n" );
- return 1;
-}