473,805 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem using the strptime function on HPUXThe strptime function works just

Hi
The strptime function works just fine on Solaris.
Here is an example on how I use it:
struct tm tmpTm;
if(strptime("20 010101010101"," %Y%m%d%H%M%S",& tmpTm)==NULL)
printf("Error,S tring convert to time Error\n");
On the HPUX platform, this call to strptime always returns NULL.
Does anybody have an idea why this does not work.

Jan 4 '06 #1
4 2287

kongkolvyu wrote:
Hi
The strptime function works just fine on Solaris.
Here is an example on how I use it:
struct tm tmpTm;
if(strptime("20 010101010101"," %Y%m%d%H%M%S",& tmpTm)==NULL)
printf("Error,S tring convert to time Error\n");
On the HPUX platform, this call to strptime always returns NULL.
Does anybody have an idea why this does not work.

Hi,

I suggest you to add a few spaces between fields, like:

strptime("2001 01","%Y %m",..

Kind regards.

PS: Problem reproduced and proposal verfied in a Tru64 machine.

Jan 4 '06 #2
kongkolvyu wrote:

The strptime function works just fine on Solaris.
Here is an example on how I use it:
struct tm tmpTm;
if(strptime("20 010101010101"," %Y%m%d%H%M%S",& tmpTm)==NULL)
printf("Error,S tring convert to time Error\n");
On the HPUX platform, this call to strptime always returns NULL.
Does anybody have an idea why this does not work.

Because strptime is not a standard C function, and you failed to
show its source code, we cannot comment on it in any way.

Whenever you need to specify a platform, you are probably off-topic
here.

--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell. org/google/>
Jan 4 '06 #3
tmp123 wrote:
kongkolvyu wrote:
Hi
The strptime function works just fine on Solaris.
Here is an example on how I use it:
struct tm tmpTm;
if(strptime("20 010101010101"," %Y%m%d%H%M%S",& tmpTm)==NULL)
printf("Error,S tring convert to time Error\n");
On the HPUX platform, this call to strptime always returns NULL.
Does anybody have an idea why this does not work.


I suggest you to add a few spaces between fields, like:


<snip>

It's a POSIX function, not part of standard C, so please redirect
further discussion of it to somewhere POSIX is topical, such as
comp.unix.progr ammer.

<OT>
How is strptime to know that you are not talking about some date in the
year 2AD? Or the year 20010AD? Or the year 20010101010101A D?
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Jan 4 '06 #4
kongkolvyu wrote:
Hi
The strptime function works just fine on Solaris.
Here is an example on how I use it:
struct tm tmpTm;
if(strptime("20 010101010101"," %Y%m%d%H%M%S",& tmpTm)==NULL)
printf("Error,S tring convert to time Error\n");
On the HPUX platform, this call to strptime always returns NULL.
Does anybody have an idea why this does not work.


RTFM. Or if the HPUX man page on strptime does not shed any
light on the matter, post your question in a HPUX newsgroup or
some other support channel for HPUX.

You could also try outputting the desired date with strftime, and
seeing what it looks like. Usually strptime functions are designed
to be able to take the output of strftime as an input. YMMV

Jan 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2108
by: Dave Harrison | last post by:
Ok before I start, please dont mail me telling me to use a more recent version of Python, I _would_ use 2.2.x but due to an existing framework all based on using 2.1.1 I have been specifically told to use 2.1.1 to avoid any crossover issues/problems. Thanks ;-) So ... Using gcc Im compiling Python2.1.1, and it configures quite reasonably, the ./configure is trascribed at the bottom of this email. now once I have done that I compile it...
0
1236
by: Brett C. | last post by:
I have received a few requests since the 'Python Cookbook' was published to edit my code for a strptime() function in pure Python to run on Jython 2.1 . I have finally come about and made the necessary changes and put them online (thanks to Jon Franz for giving the final push). The code can be found at the Python Cookbook web site at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/56036 . It is not the fastest or best version...
4
3465
by: Afanasiy | last post by:
Can I easily convert from ISO to Gregorian calendars in Python 2.3? For example, what Gregorian date is year 2004, week 1, day 1? If possible, I'd greatly prefer to do this with the standard library. I believe the mx.DateTime module provides this functionality, but I've spent a bit of time converting pre-2.3 code to the new datetime modules. ---
8
13635
by: Adam Monsen | last post by:
Anyone know of something that works like time.strptime(), but for other languages? Specifically, Dutch (ex: "31 augustus 2005, 17:26") and German? Thinking out loud... since "31 augustus 2005, 17:26" is only different by month name, I suppose I could just substitute the month name using a translation table for English to Dutch month names. -- Adam Monsen
2
1816
by: Robert | last post by:
A certain DAV server reports a time stamp as "Tues, 30 Aug 2005 20:48:31" ( but not "Tue, ..." as usual) This produces the error below. >>> time.strptime("Tue, 30 Aug 2005 20:48:31","%a, %d %b %Y %H:%M:%S") (2005, 8, 30, 20, 48, 31, 1, 242, -1) >>> time.strptime("Tues, 30 Aug 2005 20:48:31","%a, %d %b %Y %H:%M:%S") Traceback (most recent call last): File "<interactive input>", line 1, in ?
1
5239
by: mimmo | last post by:
I have a problem while calculating timezone (from Europe/Rome to Brazil/East). Can someone help me ?? Thank you, Mimmo. On this site http://www.timezoneconverter.com/cgi-bin/tzc.tzc I have for this date 2003/01/01 00:00:00:
6
10890
by: Wavelet | last post by:
want to parse the user inputed date format with strptime() function in Linux. For example,"12,17:30:20" will be explained as day 12, hour 17 etc. And I want to get the exact day. I used the following code and it works well in Solaris,but Segmentation fault in Linux. Could someone help me out? =============================================
0
1052
by: Fabio Durieux Lopes | last post by:
Hi, I'm trying to execute some operations based on a file's time. The file's time is actually the file's name (e.g. FILE1_20080326170558). So I do this: fileTimeInSecs = time.mktime(time.strptime(timeString, "%Y%m%d%H%M")) timeString contains the date part of the file's name. Function strptime returns a time_struct, but my problem is that tm_isdst is
3
11314
by: W. eWatson | last post by:
Apparently, use of strptime of datetime needs a workaround in Python 2.4 to work properly. The workaround is d = datetime.datetime(*(time.strptime(date_string, format))). However, when I try to use it, or even use it the regular way, it fails with AttributeError: type object 'datetime.datetime' has no attribute 'datetime'. From the following code code segment: format = '%Y%m%d_%H%M%S' #d=datetime.strptime('20080321_113405', format)--...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.