/say /sieste

This commit is contained in:
tth 2022-04-12 14:54:07 +02:00
parent 455428f444
commit ddfadf9a67
3 changed files with 32 additions and 10 deletions

View File

@ -4,8 +4,8 @@
* http://la.buvette.org/photos/cumul * http://la.buvette.org/photos/cumul
*/ */
#define FIMG_VERSION 179 #define FIMG_VERSION (181)
#define RELEASE_NAME ("noname")
/* /*
* in memory descriptor * in memory descriptor
*/ */
@ -25,16 +25,17 @@ typedef struct {
* fimg file header (short version) * fimg file header (short version)
*/ */
typedef struct { typedef struct {
char magic[8]; char magic[8]; // this is not an asciiz !
int32_t w, h, t; int32_t w, h, t;
} FimgFileHead; } FimgFileHead;
/* /*
* new 11 mars 2022 * new 11 mars 2022, and a lot of iterations
* around the concept of metadata for my work.
*/ */
typedef struct { typedef struct {
char magic[8]; char magic[8]; // this is not an asciiz !
struct timeval timestamp; struct timeval timestamp;
uint64_t pid; // WTF ? uint64_t pid; // process id of the creator
int32_t count; int32_t count;
float fval; float fval;
char idcam[32]; char idcam[32];

View File

@ -39,8 +39,8 @@ return "???";
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_print_version(int k) int fimg_print_version(int k)
{ {
fprintf(stderr, "*** FloatImg library, alpha %d (%s, %s)\n", fprintf(stderr, "*** FloatImg library, v%d '%s' (%s, %s)\n",
FIMG_VERSION, __DATE__, __TIME__); FIMG_VERSION, RELEASE_NAME, __DATE__, __TIME__);
if (51 == k) { if (51 == k) {
puts("+------------------------+"); puts("+------------------------+");

View File

@ -6,7 +6,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include "string.h" #include <sys/time.h>
#include <string.h>
#include "../floatimg.h" #include "../floatimg.h"
@ -29,6 +30,7 @@ fflush(fp);
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused) int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused)
{ {
int foo; int foo;
double doubletime;
fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__, fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
pmd, title, notused); pmd, title, notused);
@ -40,6 +42,10 @@ if (verbosity) {
} }
/* SHOW TIMESTAMP HERE */ /* 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, "creator pid = %ld\n", pmd->pid);
fprintf(stderr, "counter = %d\n", pmd->count); fprintf(stderr, "counter = %d\n", pmd->count);
fprintf(stderr, "float value = %.3f\n", pmd->fval); fprintf(stderr, "float value = %.3f\n", pmd->fval);
@ -57,10 +63,25 @@ return 0;
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_default_metadata(FimgMetaData *pmd) int fimg_default_metadata(FimgMetaData *pmd)
{ {
int foo;
struct timeval tvl;
memset(pmd, 0, sizeof(FimgMetaData)); memset(pmd, 0, sizeof(FimgMetaData));
memcpy(pmd->magic, "metadata", 8); memcpy(pmd->magic, "metadata", 8);
/* set timestamp here ? */ /* 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->pid = getpid();
pmd->count = 0; pmd->count = 0;
pmd->fval = 255.0; pmd->fval = 255.0;