I have a timer that loops forever. i want to log the results in a multiline.
how do i append data to the multiline?
do i have to keep copying the data out of it and then post it back?
[code]void* function( void* arg )
{
struct timespec start;
struct sigevent event;
struct itimerspec itime;
timer_t timer_id;
int chid;
int rcvid;
my_message_t msg;
chid = ChannelCreate(0);
event.sigev_notify = SIGEV_PULSE;
event.sigev_coid = ConnectAttach(ND_LOCAL_NODE, 0,chid,_NTO_SIDE_CHANNEL, 0);
event.sigev_priority = getprio(0);
event.sigev_code = MY_PULSE_CODE;
timer_create(CLOCK_REALTIME, &event, &timer_id);
itime.it_value.tv_sec = 1;
//itime.it_value.tv_nsec = 500000000;
itime.it_interval.tv_sec = 1;
//itime.it_interval.tv_nsec = 500000000;
timer_settime(timer_id, 0, &itime, NULL);
int enter_result; // Resulting of entering the Photon library lock
char *text="we got a pulse from our timer\n";
PtArg_t args[1];
PtSetArg(&args[0], Pt_ARG_TEXT_STRING, text, 0);
while(quit == 'n')
{
rcvid = MsgReceive(chid, &msg, sizeof(msg), NULL);
if (rcvid == 0) { /* we got a pulse */
if (msg.pulse.code == MY_PULSE_CODE)
{
PtEnter(0);
PtSetResources(ABW_output, 1, args);
PtLeave(0);
clock_gettime(CLOCK_REALTIME, &start);
printf("%d\n",start.tv_sec);
} /* else other pulses ... */
} /* else other messages ... */
}
return( 0 );
}[/code]