From kde-devel Wed Dec 17 19:43:11 2003 From: Gustavo Pichorim Boiko Date: Wed, 17 Dec 2003 19:43:11 +0000 To: kde-devel Subject: kdebase/kcontrol/clock patch to use /etc/localtime as file instead X-MARC-Message: https://marc.info/?l=kde-devel&m=107169035030430 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0020016240==" --===============0020016240== Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-03=_VHL4/mFJic3x+Lz"; charset="us-ascii" Content-Transfer-Encoding: 7bit --Boundary-03=_VHL4/mFJic3x+Lz Content-Type: multipart/mixed; boundary="Boundary-01=_PHL4/VuSjy7fxrk" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_PHL4/VuSjy7fxrk Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Currently, when timezone is changed, the clock applet makes a=20 symlink /etc/localtime pointing to the selected timezone.=20 This is not a good idea because some systems have /usr in another disk (or= =20 partition) and when the system is initialized and the target of symlink is= =20 not mounted yet and then, the system time is set to a wrong value. IMO is a good idea to copy the new timezone to /etc/localtime (as timeconfi= g=20 does). The attached patch fix this issue. If the patch is ok, I can commit it to c= vs. If anyone knows another way to solve this problem, please tell me. Thank's =2D-=20 Gustavo Pichorim Boiko =2D- boiko @ conectiva . com . br --Boundary-01=_PHL4/VuSjy7fxrk Content-Type: text/x-diff; charset="us-ascii"; name="localtime_as_file.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="localtime_as_file.patch" Index: tzone.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdebase/kcontrol/clock/tzone.cpp,v retrieving revision 1.25 diff -u -p -r1.25 tzone.cpp =2D-- tzone.cpp 15 Jun 2003 03:43:21 -0000 1.25 +++ tzone.cpp 17 Dec 2003 19:31:24 -0000 @@ -284,11 +284,34 @@ void Tzone::save() =20 kdDebug() << "Set time zone " << tz << endl; =20 =2D // This is extremely ugly. Who knows the better way? =2D unlink( "/etc/localtime" ); =2D if (symlink( QFile::encodeName(tz), "/etc/localtime" ) !=3D 0) =2D KMessageBox::error( 0, i18n("Error setting new Time Zone!"), =2D i18n("Timezone Error")); + if (!QFile::remove("/etc/localtime"))=20 + { + //After the KDE 3.2 release, need to add an error message + } + else + { + QFile fSelectedTz(tz); + =09 + if (fSelectedTz.open(IO_ReadOnly)) + { + QFile fLocaltime("/etc/localtime"); + =09 + if (fLocaltime.open(IO_WriteOnly | IO_Truncate)) + { + QByteArray tzdata =3D fSelectedTz.readAll(); + =09 + fSelectedTz.close(); + fLocaltime.writeBlock(tzdata); + fLocaltime.close(); + } + else + { + KMessageBox::error( 0, i18n("Error setting new Time Zone!"= ), + i18n("Timezone Error")); + + } + } + } =09 =20 QString val =3D ":" + tz; #endif // !USE_SOLARIS --Boundary-01=_PHL4/VuSjy7fxrk-- --Boundary-03=_VHL4/mFJic3x+Lz Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/4LHVZQYlDr5VjykRAm4gAJ9nvYqldGlJog0FGqQWz4l/E4wkXACeL1nf /y+Hbvh5Ly8ZTdSguUbrJGo= =8hKC -----END PGP SIGNATURE----- --Boundary-03=_VHL4/mFJic3x+Lz-- --===============0020016240== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============0020016240==--