HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Calling the strftime() Function
Operating System - HP-UX
1834458
Members
2838
Online
110067
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2001 10:36 AM
02-02-2001 10:36 AM
Calling the strftime() Function
Dear Gurus,
I am currently trying to develop my C skills, but cannot work out how to do the following ....
I want to prefix all entries to a logfile with the current sysdate/time in the format of "[ddmmmyy:HHMM.ss]" - it appears that the strftime() function call will allow me to do this, but I have absolutely no idea on how to call it !!!
Can someone please show me the lines of code I would need to use.
(Sorry for being a C-learner !!)
Regards,
Paul.
I am currently trying to develop my C skills, but cannot work out how to do the following ....
I want to prefix all entries to a logfile with the current sysdate/time in the format of "[ddmmmyy:HHMM.ss]" - it appears that the strftime() function call will allow me to do this, but I have absolutely no idea on how to call it !!!
Can someone please show me the lines of code I would need to use.
(Sorry for being a C-learner !!)
Regards,
Paul.
My Brain Hurts !!!!!
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2001 10:51 AM
02-02-2001 10:51 AM
Re: Calling the strftime() Function
Try something like this:
#include
struct tm *t;
char buf[80];
t = localtime( time(NULL) );
strftime( buf, 80, "[%d%m%y:%H%M.%S]", t );
This is straight from the time(), localtime(), and strftime() man pages.
I hope this helps.
#include
struct tm *t;
char buf[80];
t = localtime( time(NULL) );
strftime( buf, 80, "[%d%m%y:%H%M.%S]", t );
This is straight from the time(), localtime(), and strftime() man pages.
I hope this helps.
I think, therefore I am... I think!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2001 11:15 AM
02-02-2001 11:15 AM
Re: Calling the strftime() Function
Kenneth,
Many, many thanks for the assistance. Unfortunately, I am getting the following error ....
Error 212: "WriteLog.cpp", line 48 # Argument type 'tm *' does not match expected parameter type 'long *'
Thanks again,
Paul.
Many, many thanks for the assistance. Unfortunately, I am getting the following error ....
Error 212: "WriteLog.cpp", line 48 # Argument type 'tm *' does not match expected parameter type 'long *'
Thanks again,
Paul.
My Brain Hurts !!!!!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP