forked from tTh/FloatImg
/say /sieste
This commit is contained in:
parent
455428f444
commit
ddfadf9a67
13
floatimg.h
13
floatimg.h
@ -4,8 +4,8 @@
|
||||
* http://la.buvette.org/photos/cumul
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 179
|
||||
|
||||
#define FIMG_VERSION (181)
|
||||
#define RELEASE_NAME ("noname")
|
||||
/*
|
||||
* in memory descriptor
|
||||
*/
|
||||
@ -25,16 +25,17 @@ typedef struct {
|
||||
* fimg file header (short version)
|
||||
*/
|
||||
typedef struct {
|
||||
char magic[8];
|
||||
char magic[8]; // this is not an asciiz !
|
||||
int32_t w, h, t;
|
||||
} FimgFileHead;
|
||||
/*
|
||||
* new 11 mars 2022
|
||||
* new 11 mars 2022, and a lot of iterations
|
||||
* around the concept of metadata for my work.
|
||||
*/
|
||||
typedef struct {
|
||||
char magic[8];
|
||||
char magic[8]; // this is not an asciiz !
|
||||
struct timeval timestamp;
|
||||
uint64_t pid; // WTF ?
|
||||
uint64_t pid; // process id of the creator
|
||||
int32_t count;
|
||||
float fval;
|
||||
char idcam[32];
|
||||
|
@ -39,8 +39,8 @@ return "???";
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_print_version(int k)
|
||||
{
|
||||
fprintf(stderr, "*** FloatImg library, alpha %d (%s, %s)\n",
|
||||
FIMG_VERSION, __DATE__, __TIME__);
|
||||
fprintf(stderr, "*** FloatImg library, v%d '%s' (%s, %s)\n",
|
||||
FIMG_VERSION, RELEASE_NAME, __DATE__, __TIME__);
|
||||
|
||||
if (51 == k) {
|
||||
puts("+------------------------+");
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include "string.h"
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
@ -29,6 +30,7 @@ fflush(fp);
|
||||
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused)
|
||||
{
|
||||
int foo;
|
||||
double doubletime;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
|
||||
pmd, title, notused);
|
||||
@ -40,6 +42,10 @@ if (verbosity) {
|
||||
}
|
||||
|
||||
/* SHOW TIMESTAMP HERE */
|
||||
fprintf(stderr, "seconds sc. epoch = %ld\n", pmd->timestamp.tv_sec);
|
||||
doubletime = (double)pmd->timestamp.tv_sec + \
|
||||
(double)pmd->timestamp.tv_usec / 1e6;
|
||||
fprintf(stderr, "dtime of day = %e\n", doubletime);
|
||||
fprintf(stderr, "creator pid = %ld\n", pmd->pid);
|
||||
fprintf(stderr, "counter = %d\n", pmd->count);
|
||||
fprintf(stderr, "float value = %.3f\n", pmd->fval);
|
||||
@ -48,7 +54,7 @@ fprintf(stderr, "origin = 0x%x\n", pmd->origin);
|
||||
|
||||
fputs("reserved words are:\n ", stderr);
|
||||
for (foo=0; foo<8; foo++) {
|
||||
fprintf(stderr, " 0x%08x", pmd->reserved[foo]);
|
||||
fprintf(stderr, " 0x%08x", pmd->reserved[foo]);
|
||||
if (3 == foo) fputs("\n ", stderr);
|
||||
}
|
||||
fputc('\n', stderr);
|
||||
@ -57,10 +63,25 @@ return 0;
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_default_metadata(FimgMetaData *pmd)
|
||||
{
|
||||
int foo;
|
||||
struct timeval tvl;
|
||||
|
||||
memset(pmd, 0, sizeof(FimgMetaData));
|
||||
memcpy(pmd->magic, "metadata", 8);
|
||||
|
||||
/* set timestamp here ? */
|
||||
/* CHALLENGE ACCEPTED */
|
||||
memset(&tvl, 0, sizeof(struct timeval));
|
||||
foo = gettimeofday(&tvl, NULL);
|
||||
if (foo) {
|
||||
/* error on get time of day ? */
|
||||
perror("omg");
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Time of day %12ld %12ld\n", tvl.tv_sec, tvl.tv_usec);
|
||||
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
pmd->pid = getpid();
|
||||
pmd->count = 0;
|
||||
pmd->fval = 255.0;
|
||||
|
Loading…
Reference in New Issue
Block a user