how to set time in ordinary user in program?

My system is Qnx6.1.0.

I need to change the time in ordinary account.
In " root " account,I can use clock_settime() to set system time.
But in normal user,the function clock_settime() can’t be use.And it
seems that only root can change the time.

At the same time ,the date utility can’t
be use in normal user but in root account.
But in User’s configuration “Time & Date”,I can change the
time in ordinary user,how does the system finish it.
How to set time in ordinary user in program C?

“zhz_zhang” <zhz_zhang26@sina.com> wrote in message
news:aonlko$k3p$1@inn.qnx.com

My system is Qnx6.1.0.

I need to change the time in ordinary account.
In " root " account,I can use clock_settime() to set system time.
But in normal user,the function clock_settime() can’t be use.And it
seems that only root can change the time.

At the same time ,the date utility can’t
be use in normal user but in root account.
But in User’s configuration “Time & Date”,I can change the
time in ordinary user,how does the system finish it.
How to set time in ordinary user in program C?

The program has to have the stick bit set (so it has root permission)

Only root can change date and time.
Randy Hyde

“zhz_zhang” <zhz_zhang26@sina.com> wrote in message news:aonlko$k3p$1@inn.qnx.com

My system is Qnx6.1.0.

I need to change the time in ordinary account.
In " root " account,I can use clock_settime() to set system time.
But in normal user,the function clock_settime() can’t be use.And it
seems that only root can change the time.

At the same time ,the date utility can’t
be use in normal user but in root account.
But in User’s configuration “Time & Date”,I can change the
time in ordinary user,how does the system finish it.
How to set time in ordinary user in program C?

zhz_zhang <zhz_zhang26@sina.com> wrote:

I am newuser ,how to set? what does the stick bit mean?

Take a look at the chmod utility – the sticky bit is also called
the setuid bit.

The program to change date/time must be owned by root, and setuid
root.

as root:

chown root program
chmod u+s program

This is normal Unix style file permissions and effects.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

zhz_zhang <zhz_zhang26@sina.com> wrote:

My system is Qnx6.1.0.

I need to change the time in ordinary account.

This is a bad idea. If you give everyone the ability to set
the time, then the reality is that they will, which can cause
some real issues if you are relying on timestamps in any log
files, or syncronizing with a network.

The date/time is setable by root for a reason. The reason is
simply that only one person should be able to (and responsible
for) setting the time. That user is root.

Cheers,
Camz.

I am newuser ,how to set? what does the stick bit mean?

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:aonpgg$nvk$1@inn.qnx.com

“zhz_zhang” <> zhz_zhang26@sina.com> > wrote in message
news:aonlko$k3p$> 1@inn.qnx.com> …
My system is Qnx6.1.0.

I need to change the time in ordinary account.
In " root " account,I can use clock_settime() to set system time.
But in normal user,the function clock_settime() can’t be use.And it
seems that only root can change the time.

At the same time ,the date utility can’t
be use in normal user but in root account.
But in User’s configuration “Time & Date”,I can change the
time in ordinary user,how does the system finish it.
How to set time in ordinary user in program C?


The program has to have the stick bit set (so it has root permission)
\

Hi, sorry to correct you: sticky bit is - at least in POSIX.1 standard -
differently defined from setuid/setgid-bit
Jörg

David Gibbs schrieb:

zhz_zhang <> zhz_zhang26@sina.com> > wrote:
I am newuser ,how to set? what does the stick bit mean?

Take a look at the chmod utility – the sticky bit is also called
the setuid bit.

The program to change date/time must be owned by root, and setuid
root.

as root:

chown root program
chmod u+s program

This is normal Unix style file permissions and effects.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.


============ lat=52.35°N - lon=10.25°E ================================
Dr. Jörg Kampmann - IBK-Consult for Real-Time and Embedded Systems
D-31228 Peine - Tel.:+49-177-276-3140 - Fax: +49-5171-13385
http://www.ibk-consult.de
===== QNX is the better Choice for Real-Time: http://www.qnx.com ====

Joerg Kampmann <joerg.kampmann@ibk-consult.de> wrote:

Hi, sorry to correct you: sticky bit is - at least in POSIX.1 standard -
differently defined from setuid/setgid-bitÿà

You are correct, and I actually knew that… somebody else had
referred to setting the sticky bit, and I didn’t think through
my response well enough.

-David

Jörg

David Gibbs schrieb:

zhz_zhang <> zhz_zhang26@sina.com> > wrote:
I am newuser ,how to set? what does the stick bit mean?

Take a look at the chmod utility – the sticky bit is also called
the setuid bit.

The program to change date/time must be owned by root, and setuid
root.

as root:

chown root program
chmod u+s program

This is normal Unix style file permissions and effects.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.


============ lat=52.35°N - lon=10.25°E ===============================> Dr. Jörg Kampmann - IBK-Consult for Real-Time and Embedded Systems
D-31228 Peine - Tel.:+49-177-276-3140 - Fax: +49-5171-13385
http://www.ibk-consult.de
===== QNX is the better Choice for Real-Time: > http://www.qnx.com > ===

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.