Setting time from application


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Setting time from application
# 1  
Old 04-21-2009
Setting time from application

Hello all,

I wish to set the time and date of the system from my application. (I write code in C ).

How can it be done?

I found the function stime() - but it gets time in seconds as a parameter, and I don't know how to convert my time & date to seconds since EPOCH.

What's the best way of setting the date and time from my application ?

Thank you very much...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Time setting on Solaris 10

Hi all, Any idea please how to: -Change Time format from 24h format to 12h format (AM and PM) -Turn off DST: Daylight Save Time on a Solaris10 server Thanks in advance (1 Reply)
Discussion started by: rafikrafik09
1 Replies

2. UNIX for Advanced & Expert Users

OS level setting parameter for Application Hanging

Hi We are facing Application hanging issue from users who log in to applications from the server. But through other server , all the transactions are working fine. Now how can i can compare the OS level parameter setting on both servers. Or please suggest me your ideas to debug thes... (1 Reply)
Discussion started by: susa_dgl
1 Replies

3. Solaris

takes time to connect my application

getting delayed to connect to my database in solaris Does anyone help me to get out of this issue help will be more appreciated. (2 Replies)
Discussion started by: Gods_help
2 Replies

4. Solaris

Setting up SSH - first time

Good day to you all. I have a server (running on SunOS 5.8) that i always got into via telnet. I have eventually decided to block telnet access to it and instead look toward using SSH. The problem is, whne i establish the SSH connection via PuTTy, i get the "Log in as" prompt, but upon... (5 Replies)
Discussion started by: de049
5 Replies

5. UNIX for Advanced & Expert Users

time out for a Client application

Hi , I have a Application running on unix , how could i log out the user if the user doest use the application for specified period of time . using TMOUT it log out the session but with $prompt. But here i am inside the application , i would like to logout the user from application... (2 Replies)
Discussion started by: naren_chella
2 Replies

6. UNIX for Dummies Questions & Answers

need help setting time!

I am trying to change the time on a Sun Solaris System, but I am having some difficulties. I thought by accessing the clock icon in the CDE would allow me to change the time. Also when I clicked the help icon I still could not fine any information. (1 Reply)
Discussion started by: wmosley2
1 Replies

7. UNIX for Dummies Questions & Answers

Setting Directory Time

How would I modify the time of a directory? The touch command appears to only work on files and I searched through the threads looking for an example on dealing with directories. I have a directory that has a recent date, but none of the files within the directory are recent. I'd like to set... (2 Replies)
Discussion started by: jgordon
2 Replies

8. UNIX for Dummies Questions & Answers

Time zone setting

Tru64 (4.0D) How to change the time zone setting for the system? Sanjay (5 Replies)
Discussion started by: sanjay_g
5 Replies

9. UNIX for Dummies Questions & Answers

setting session time

Please lemme know how & where to set the session time for ftp connection in Wu-ftp . Regards Gambhi. (5 Replies)
Discussion started by: gambhi_s
5 Replies

10. UNIX for Dummies Questions & Answers

setting date and time

how do i set the system date and time? i know i have to be root to do it but i'm new to unix--really new--and some of this stuff seems really cryptic. thanks for any help.:confused: (2 Replies)
Discussion started by: singlefin
2 Replies
Login or Register to Ask a Question
STIME(2)						     Linux Programmer's Manual							  STIME(2)

NAME
stime - set time SYNOPSIS
#include <time.h> int stime(const time_t *t); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): stime(): Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _SVID_SOURCE DESCRIPTION
stime() sets the system's idea of the time and date. The time, pointed to by t, is measured in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). stime() may be executed only by the superuser. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EFAULT Error in getting information from user space. EPERM The calling process has insufficient privilege. Under Linux, the CAP_SYS_TIME privilege is required. CONFORMING TO
SVr4. SEE ALSO
date(1), settimeofday(2), capabilities(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2016-03-15 STIME(2)