What C function should I call to obtain a formatted date and time for the locale where the program is being executed?
I'm asking this question because I have run into a ... |
I am getting some warnings when compiling a C program on OSX 10.6.5, which seem to be quite critical.
extras.c:15: warning: implicit declaration of function ‘time’
extras.c: In function ‘outlog’:
extras.c:363: warning: implicit declaration ...
|
I'm writing an application in C that parses data files recorded by an external program (over which I have no control). It's storing binary data, one field of which is ... |
I am interested in showing the execution time for a program in C, at diverse points, using ctime.
I have tried something like that, but it must not be right...
int main() ...
|
If time_t is defined as __darwin_time, which itself is defined as long in MacOS X, why does the following code outputs 8 Time is (null)? Maybe it's something silly, but I ... |
Here is my program time_play.c :
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int
main (void)
{
char *time_str = "2011-07-20 17:30:18";
time_t time_tm = getdate(time_str);
printf("str: %s and ...
|
sorry that was example code from cplusplus reference... i dont think you read my first post... im trying to say, and i quote myself How do I use the library ctime to set the current time in: seconds, hours (24 hour), minutes into separate integers. And how do i do the same thing with dates setting the current year, day , ... |
|
I am try ing to use ctime with the type time_t , I used .... time_t t = time(0); char* sc = ctime( &t); printf ("%s\n", sc); .... it crashes for 64 bit compilations but does file with gcc -m32, Is there a any fix to this problem, I am searching for a 64 bit compatible definition for ctime , is ... |
Gary Wessle wrote: > Hi > I am not getting current time with this program, what am I doing wrong? > #include #include using namespace std; > #define P(x) cout << #x " = " << (x) << "\n"; > int main(){ time_t rawtime; P( rawtime ); P( ctime(& rawtime) ); } > **************** output **************** rawtime = 0 ... |
10. ctime adds \n cboard.cprogramming.com |
|
long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) |
whole code I thought I would post the whole pgm - in case something else is causing the error. I guess more info is better than less....... Thanks Sue vi bistruct.c #include #include #include #include #define NAMESIZE 256 #define TIMESIZE 50 typedef char name_type[NAMESIZE + 1]; typedef char time_type[TIMESIZE +1]; //typedef struct //{ // char in_name[NAMESIZE]; //} ... |
struct tm { int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */ int tm_min; /* Minutes: 0-59 */ int tm_hour; /* Hours since midnight: 0-23 */ int tm_mday; /* Day of the month: 1-31 */ int tm_mon; /* Months *since* january: 0-11 */ int tm_year; /* Years since 1900 */ int tm_wday; /* Days since Sunday (0-6) */ int tm_yday; /* ... |
|
When I run the following code I get two error messages: p58Exercise2.cpp(19): error C2533: 't_and_d::__ctor' : constructors not allowed a return type p58Exercise2.cpp(19): fatal error C1903: unable to recover from previous error(s); stopping compilation I can't figure out why? any help would be apreciated I am working with the book "Teach Yourself C++" third edition. The excersie I am trying to ... |
|
when I run this, I get: Thu Sep 4 10:45:02 2003I need the time in seconds only, how would I do that?I want to delete files after a certain time limit and I do a stat on the file and it gives me it's creation time in seconds (I believe ;o)), so I need to get this ... |