kerneltest/e32test/datetime/t_time.cpp
changeset 271 dc268b18d709
parent 31 56f325a607ea
--- a/kerneltest/e32test/datetime/t_time.cpp	Mon Sep 13 15:16:07 2010 +0100
+++ b/kerneltest/e32test/datetime/t_time.cpp	Wed Sep 22 10:53:45 2010 +0100
@@ -1906,14 +1906,17 @@
 	// The platform may or may not support SecureTime, and even if it does,
 	// it may not have a secure time set. So we start this test by making
 	// sure that the NonSecureOffset is set (which may fail, if it's not
-	// supported OR if it's already set); then read and write the secure
-	// time, to make sure that it's supported and we have permission.
+	// supported OR if it's already set); then read and write and reread
+	// secure time, to make sure that it's supported and we have permission.
+	//
+	test.Next(_L("Test absolute timers with secure time change"));
 	User::SetUTCTime(now);
 	HAL::Set(HAL::ETimeNonSecureOffset, 0);
-	test.Next(_L("Test absolute timers with secure time change"));
 	TTime securetime;
-	if ((r = securetime.UniversalTimeSecure()) == KErrNone)
-		r = User::SetUTCTimeSecure(securetime);
+	if ((r = securetime.UniversalTimeSecure()) != KErrNone)
+		securetime = now;
+	if ((r = User::SetUTCTimeSecure(securetime)) == KErrNone)
+		r = securetime.UniversalTimeSecure();
 	if (r != KErrNone)
 		{
 		RDebug::Printf("WARNING: Secure clock change test skipped because secure time could not be changed!");