- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Conversion problem Pl help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО07-19-2007 04:24 AM
тАО07-19-2007 04:24 AM
Conversion problem Pl help
clock = time(0);
cftime(system_date_day,"%d",&clock);
/* this next kludge is to prevent sccs from expanding things */
/* when letters are bracked by percent signs */
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"Y");
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"m");
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"d");
cftime(full_date,sccs_kludge,&clock);
Hw do i convert the same above into HP, Pl help.
Thanks
Gopala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2007 05:37 AM
тАО07-19-2007 05:37 AM
Re: Conversion problem Pl help
not knowing, how your variable sccs_kludge is defined + allocated, I suggest to use a
strcpy(sccs_kludge,"%");
for the first setting, then use your strcat()'s.
So no implicit NULLify of your array(?) is needed.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2007 07:16 AM
тАО07-19-2007 07:16 AM
Re: Conversion problem Pl help
- Tags:
- strftime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2007 07:57 AM
тАО07-19-2007 07:57 AM
Re: Conversion problem Pl help
I appreciate your help.
Thanks
Gopala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2007 08:23 AM
тАО07-19-2007 08:23 AM
Re: Conversion problem Pl help
#include
#include
int main(int argc, char *argv[])
{
time_t clock;
char buf[BUFSIZ];
struct tm tmobj, *tmptr = &tmobj;
clock = time(0);
tmptr = localtime(&clock);
strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Z %Y", tmptr);
printf("%s\n", buf);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2007 08:31 AM
тАО07-19-2007 08:31 AM
Re: Conversion problem Pl help
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2007 02:07 AM
тАО07-20-2007 02:07 AM
Re: Conversion problem Pl help
I highly appreciate your response.
I converted to the below and getting core dump, Pl let me know what we are doing worng, Also when we pass that varaible to other program the full_date converts to sysdate in 20070720 in that format.
time_t clock;
char system_date_day[3];
char revenue_date[7];
char full_date[9];
char sccs_kludge[7];
struct tm *time_ptr;
struct tm *time_ptr;
#ifdef DBGtrace
printf("in get_tcm\n");
#endif
/*clock = time(0);
strftime(system_date_day,3,"%d",&clock);
*/
time_ptr = gmtime(&clock);
clock = time(0);
strftime(system_date_day,3,"%d",time_ptr);
/* this next kludge is to prevent sccs from expanding things */
/* when letters are bracked by percent signs */
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"Y");
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"m");
strcat(sccs_kludge,"%");
strcat(sccs_kludge,"d");
strftime(full_date,9,sccs_kludge,time_ptr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2007 03:02 AM
тАО07-20-2007 03:02 AM
Re: Conversion problem Pl help
above struct is declared twice; not sure if you meant to declare an object of that type plus a pointer to it as in:
struct tm tmobj;
struct tm *tmptr;
>time_ptr = gmtime(&clock);
>clock = time(0);
"clock" variable is initialized after extracting its value with the gmtime() function which is incorrect. Swap the two statements around:
clock=time(0);
time_ptr=gmtime(&clock);
Other than giving erroneous results it does not core dump on my PARISC system. What machine and OS are you using? Try to get a stack trace from the core file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2007 03:22 AM
тАО07-20-2007 03:22 AM
Re: Conversion problem Pl help
Yesterday we got coredump and today it ran well but without the correct data, So we put another fix to copy value into the varaible.
I appreciate your response.
Thanks
Gopala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-20-2007 04:29 PM
тАО07-20-2007 04:29 PM
Re: Conversion problem Pl help
In fact, you should NOT be using strcat nor strcpy. Use an array initializer:
char sccs_kludge[7] = { '%', 'Y', '%', 'm', '%', 'd' };
Instead of hardcoding 9 here: strftime(full_date,9
you should use: strftime(full_date,sizeof(full_date)
- Tags:
- strcat