Discussion:
strptime()
Add Reply
root
2024-12-05 17:30:46 UTC
Reply
Permalink
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
root
2024-12-05 17:51:14 UTC
Reply
Permalink
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
Don't bother with this. I found a solution that does not use
strptime(). ChatGPT gave me the programs.
Henrik Carlqvist
2024-12-05 17:54:30 UTC
Reply
Permalink
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime() which
gcc on Slackware 15.0 does not recognize.
At least Slackware 15.0 has a man page for strptime. Did you try to

#define _XOPEN_SOURCE

before your

#include <time.h>

?

regards Henrik
root
2024-12-06 03:51:17 UTC
Reply
Permalink
Post by Henrik Carlqvist
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime() which
gcc on Slackware 15.0 does not recognize.
At least Slackware 15.0 has a man page for strptime. Did you try to
#define _XOPEN_SOURCE
before your
#include <time.h>
?
regards Henrik
Thanks for responding Henrik. No, I know know nothing
about _XOPEN_SOURCE.
Giovanni
2024-12-05 18:00:02 UTC
Reply
Permalink
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
I never used it but but I see that is included in the standard library.
Did you try "man strptime"?

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
< https://giovanni.homelinux.net/ >
Lew Pitcher
2024-12-05 19:07:59 UTC
Reply
Permalink
Post by Giovanni
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
I never used it but but I see that is included in the standard library.
Did you try "man strptime"?
He didn't bother. He's just a code monkey, copying code "written" by a
Large Language Model, and doesn't really know what he's doing.
--
Lew Pitcher
"In Skills We Trust"
root
2024-12-06 03:59:32 UTC
Reply
Permalink
Post by Lew Pitcher
Post by Giovanni
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
I never used it but but I see that is included in the standard library.
Did you try "man strptime"?
He didn't bother. He's just a code monkey, copying code "written" by a
Large Language Model, and doesn't really know what he's doing.
It sure seems lile that, but I have been coding for seventy years.
I am working on a larger project and needed to pop back and
forth between different date formats including seconds from
epoch. I saw two options: 1) could try to work out the
details myself, 2) I could use popen and pass the problem
to a system call. I wanted to do it faster than either
1 or 2, so I thought I would give an AI a chance to
help. Try it yourself sometime.
root
2024-12-06 03:53:08 UTC
Reply
Permalink
Post by Giovanni
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
I never used it but but I see that is included in the standard library.
Did you try "man strptime"?
Ciao
Giovanni
I never thought to do man strptime. Right at the top
it gives the XOPEN thing. I was trying various
lib things.
Rich
2024-12-06 18:02:04 UTC
Reply
Permalink
Post by root
Post by Giovanni
Post by root
I asked Gemini to give me a c program to convert date format to epoch
time and conversely. It provided a program that uses strptime()
which gcc on Slackware 15.0 does not recognize. My version
of gcc is gcc version 11.2.0 (GCC). I don't have an installation
with current so I can't check if a later version of gcc will
work. Anyone here use strptime?
Thanks.
I never used it but but I see that is included in the standard library.
Did you try "man strptime"?
Ciao
Giovanni
I never thought to do man strptime. Right at the top
it gives the XOPEN thing. I was trying various
lib things.
When encountering something on a Linux machine (esp. a library
function) for which you are unfamiliar, your very first thought should
*always* be: "lets check for a man page".
root
2024-12-06 20:48:43 UTC
Reply
Permalink
Post by Rich
When encountering something on a Linux machine (esp. a library
function) for which you are unfamiliar, your very first thought should
*always* be: "lets check for a man page".
It will be my first step from now on. Thanks for responding.

Loading...