Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
b166579f4b
|
@ -27,7 +27,7 @@ zmdc.pl - ZoneMinder Daemon Control script
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmdc.pl {command} [daemon [options]]
|
||||
zmdc.pl {command} [daemon [options]]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
@ -39,12 +39,13 @@ connect to the server and pass instructions to it.
|
|||
|
||||
=head1 OPTIONS
|
||||
|
||||
{command} - One of 'startup|shutdown|status|check|logrot' or
|
||||
'start|stop|restart|reload|version'.
|
||||
[daemon [options]] - Daemon name and options, required for second group of commands
|
||||
{command} - One of 'startup|shutdown|status|check|logrot' or
|
||||
'start|stop|restart|reload|version'.
|
||||
[daemon [options]] - Daemon name and options, required for second group of commands
|
||||
|
||||
=cut
|
||||
use strict;
|
||||
use warnings;
|
||||
use bytes;
|
||||
|
||||
# ==========================================================================
|
||||
|
@ -53,7 +54,9 @@ use bytes;
|
|||
#
|
||||
# ==========================================================================
|
||||
|
||||
use constant MAX_CONNECT_DELAY => 10;
|
||||
# in useconds, not seconds.
|
||||
use constant MAX_CONNECT_DELAY => 10*1000*1000;
|
||||
use constant KILL_DELAY => 10*1000; # 1/10th of a second
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
|
@ -66,6 +69,7 @@ use ZoneMinder;
|
|||
use POSIX;
|
||||
use Socket;
|
||||
use IO::Handle;
|
||||
use Time::HiRes qw(usleep);
|
||||
use autouse 'Pod::Usage'=>qw(pod2usage);
|
||||
#use Data::Dumper;
|
||||
|
||||
|
@ -98,10 +102,10 @@ my @daemons = (
|
|||
'zmupdate.pl',
|
||||
'zmtrack.pl',
|
||||
'zmtelemetry.pl'
|
||||
);
|
||||
);
|
||||
|
||||
my $command = shift @ARGV;
|
||||
if( !$command ) {
|
||||
if( ! $command ) {
|
||||
print( STDERR "No command given\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
@ -111,7 +115,7 @@ if ( $command eq 'version' ) {
|
|||
}
|
||||
my $needs_daemon = $command !~ /(?:startup|shutdown|status|check|logrot|version)/;
|
||||
my $daemon = shift( @ARGV );
|
||||
if( $needs_daemon && !$daemon ) {
|
||||
if ( $needs_daemon && ! $daemon ) {
|
||||
print( STDERR "No daemon given\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
@ -128,8 +132,8 @@ if ( $needs_daemon ) {
|
|||
}
|
||||
|
||||
foreach my $arg ( @ARGV ) {
|
||||
# Detaint arguments, if they look ok
|
||||
#if ( $arg =~ /^(-{0,2}[\w]+)/ )
|
||||
# Detaint arguments, if they look ok
|
||||
#if ( $arg =~ /^(-{0,2}[\w]+)/ )
|
||||
if ( $arg =~ /^(-{0,2}[\w\/?&=.-]+)$/ ) {
|
||||
push( @args, $1 );
|
||||
} else {
|
||||
|
@ -142,8 +146,10 @@ socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
|
|||
|
||||
my $saddr = sockaddr_un( SOCK_FILE );
|
||||
my $server_up = connect( CLIENT, $saddr );
|
||||
if ( !$server_up ) {
|
||||
if ( ! $server_up ) {
|
||||
# Server is not up. Some commands can still be handled
|
||||
if ( $command eq 'logrot' ) {
|
||||
# If server is not running, then logrotate doesn't need to do anything.
|
||||
exit();
|
||||
}
|
||||
if ( $command eq 'check' ) {
|
||||
|
@ -153,43 +159,47 @@ if ( !$server_up ) {
|
|||
print( "Unable to connect to server using socket at " . SOCK_FILE . "\n" );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
# The server isn't there
|
||||
print( "Starting server\n" );
|
||||
close( CLIENT );
|
||||
|
||||
if ( my $cpid = fork() ) {
|
||||
# Parent process just sleep and fall through
|
||||
|
||||
# I'm still not sure why we need to re-init the logs
|
||||
logInit();
|
||||
|
||||
# Parent process just sleep and fall through
|
||||
socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
|
||||
my $attempts = 0;
|
||||
while (!connect( CLIENT, $saddr )) {
|
||||
while( !connect( CLIENT, $saddr ) ) {
|
||||
$attempts++;
|
||||
Error("Waiting for zmdc.pl server process, attempt $attempts" );
|
||||
Fatal( "Can't connect: $!" ) if ($attempts > MAX_CONNECT_DELAY);
|
||||
sleep(1);
|
||||
}
|
||||
usleep(100);
|
||||
} # end while
|
||||
} elsif ( defined($cpid) ) {
|
||||
ZMServer::run();
|
||||
} else {
|
||||
Fatal( "Can't fork: $!" );
|
||||
}
|
||||
}
|
||||
if ( $command eq 'check' && !$daemon ) {
|
||||
} # end if ! server is up
|
||||
|
||||
if ( $command eq 'check' && ! $daemon ) {
|
||||
print( "running\n" );
|
||||
exit();
|
||||
} elsif ( $command eq 'startup' ) {
|
||||
# Our work here is done
|
||||
exit() if ( !$server_up );
|
||||
}
|
||||
|
||||
# The server is there, connect to it
|
||||
#print( "Writing commands\n" );
|
||||
CLIENT->autoflush();
|
||||
my $message = "$command";
|
||||
$message .= ";$daemon" if ( $daemon );
|
||||
$message .= ";".join( ';', @args ) if ( @args );
|
||||
my $message = join(';', $command, ( $daemon ? $daemon : () ), @args );
|
||||
print( CLIENT $message );
|
||||
shutdown( CLIENT, 1 );
|
||||
while ( my $line = <CLIENT> ) {
|
||||
while( my $line = <CLIENT> ) {
|
||||
chomp( $line );
|
||||
print( "$line\n" );
|
||||
}
|
||||
|
@ -202,6 +212,7 @@ exit;
|
|||
package ZMServer;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use bytes;
|
||||
|
||||
@EXTRA_PERL_LIB@
|
||||
|
@ -275,7 +286,7 @@ sub run {
|
|||
} elsif ( $command eq 'reload' ) {
|
||||
reload( $daemon, @args );
|
||||
} elsif ( $command eq 'startup' ) {
|
||||
# Do nothing, this is all we're here for
|
||||
# Do nothing, this is all we're here for
|
||||
dPrint( ZoneMinder::Logger::WARNING, "Already running, ignoring command '$command'\n" );
|
||||
} elsif ( $command eq 'shutdown' ) {
|
||||
shutdownAll();
|
||||
|
@ -298,9 +309,9 @@ sub run {
|
|||
}
|
||||
} elsif ( $nfound < 0 ) {
|
||||
if ( $! == EINTR ) {
|
||||
# Dead child, will be reaped
|
||||
#print( "Probable dead child\n" );
|
||||
# See if it needs to start up again
|
||||
# Dead child, will be reaped
|
||||
#print( "Probable dead child\n" );
|
||||
# See if it needs to start up again
|
||||
restartPending();
|
||||
} elsif ( $! == EPIPE ) {
|
||||
Error( "Can't select: $!" );
|
||||
|
@ -308,7 +319,7 @@ sub run {
|
|||
Fatal( "Can't select: $!" );
|
||||
}
|
||||
} else {
|
||||
#print( "Select timed out\n" );
|
||||
#print( "Select timed out\n" );
|
||||
restartPending();
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +364,7 @@ sub start {
|
|||
my $process = $cmd_hash{$command};
|
||||
|
||||
if ( !$process ) {
|
||||
# It's not running, or at least it's not been started by us
|
||||
# It's not running, or at least it's not been started by us
|
||||
$process = { daemon=>$daemon, args=>\@args, command=>$command, keepalive=>!undef };
|
||||
} elsif ( $process->{pid} && $pid_hash{$process->{pid}} ) {
|
||||
dPrint( ZoneMinder::Logger::INFO, "'$process->{command}' already running at "
|
||||
|
@ -381,7 +392,7 @@ sub start {
|
|||
$cmd_hash{$process->{command}} = $pid_hash{$cpid} = $process;
|
||||
sigprocmask( SIG_SETMASK, $sigset ) or Fatal( "Can't restore SIGCHLD: $!" );
|
||||
} elsif ( defined($cpid ) ) {
|
||||
# Force reconnection to the db.
|
||||
# Force reconnection to the db.
|
||||
zmDbConnect(1);
|
||||
logReinit();
|
||||
|
||||
|
@ -399,7 +410,7 @@ sub start {
|
|||
|
||||
my @good_args;
|
||||
foreach my $arg ( @args ) {
|
||||
# Detaint arguments, if they look ok
|
||||
# Detaint arguments, if they look ok
|
||||
if ( $arg =~ /^(-{0,2}[\w\/?&=.-]+)$/ ) {
|
||||
push( @good_args, $1 );
|
||||
} else {
|
||||
|
@ -415,7 +426,7 @@ sub start {
|
|||
POSIX::close( $fd++ );
|
||||
}
|
||||
|
||||
# Child process
|
||||
# Child process
|
||||
$SIG{CHLD} = 'DEFAULT';
|
||||
$SIG{INT} = 'DEFAULT';
|
||||
$SIG{TERM} = 'DEFAULT';
|
||||
|
@ -474,7 +485,7 @@ sub kill_until_dead {
|
|||
}
|
||||
|
||||
sigprocmask(SIG_UNBLOCK, $blockset) or die "dying at unblock...\n";
|
||||
usleep( 100 );
|
||||
usleep( KILL_DELAY );
|
||||
sigprocmask(SIG_BLOCK, $blockset, $sigset ) or die "dying at block...\n";
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +592,7 @@ sub reaper {
|
|||
$out_str .= 'normally';
|
||||
}
|
||||
}
|
||||
#print( ", core dumped" ) if ( $core_dumped );
|
||||
#print( ", core dumped" ) if ( $core_dumped );
|
||||
$out_str .= "\n";
|
||||
|
||||
if ( $exit_status == 0 ) {
|
||||
|
@ -591,16 +602,16 @@ sub reaper {
|
|||
}
|
||||
|
||||
if ( $process->{keepalive} ) {
|
||||
# Schedule for immediate restart
|
||||
# Schedule for immediate restart
|
||||
$cmd_hash{$process->{command}} = $process;
|
||||
if ( !$process->{delay} || ($process->{runtime} > $Config{ZM_MAX_RESTART_DELAY} ) ) {
|
||||
#start( $process->{daemon}, @{$process->{args}} );
|
||||
#start( $process->{daemon}, @{$process->{args}} );
|
||||
$process->{pending} = $process->{stopped};
|
||||
$process->{delay} = 5;
|
||||
} else {
|
||||
$process->{pending} = $process->{stopped}+$process->{delay};
|
||||
$process->{delay} *= 2;
|
||||
# Limit the start delay to 15 minutes max
|
||||
# Limit the start delay to 15 minutes max
|
||||
if ( $process->{delay} > $Config{ZM_MAX_RESTART_DELAY} ) {
|
||||
$process->{delay} = $Config{ZM_MAX_RESTART_DELAY};
|
||||
}
|
||||
|
@ -612,7 +623,7 @@ sub reaper {
|
|||
}
|
||||
|
||||
sub restartPending {
|
||||
# Restart any pending processes
|
||||
# Restart any pending processes
|
||||
foreach my $process ( values( %cmd_hash ) ) {
|
||||
if ( $process->{pending} && $process->{pending} <= time() ) {
|
||||
dPrint( ZoneMinder::Logger::INFO, "Starting pending process, $process->{command}\n" );
|
||||
|
@ -623,12 +634,12 @@ sub restartPending {
|
|||
|
||||
sub shutdownAll {
|
||||
foreach my $pid ( keys %pid_hash ) {
|
||||
# This is a quick fix because a SIGCHLD can happen and alter pid_hash while we are in here.
|
||||
# This is a quick fix because a SIGCHLD can happen and alter pid_hash while we are in here.
|
||||
next if ! $pid_hash{$pid};
|
||||
send_stop( 1, $pid_hash{$pid} );
|
||||
}
|
||||
foreach my $pid ( keys %pid_hash ) {
|
||||
# This is a quick fix because a SIGCHLD can happen and alter pid_hash while we are in here.
|
||||
# This is a quick fix because a SIGCHLD can happen and alter pid_hash while we are in here.
|
||||
next if ! $pid_hash{$pid};
|
||||
|
||||
my $process = $pid_hash{$pid};
|
||||
|
@ -637,7 +648,9 @@ sub shutdownAll {
|
|||
delete( $cmd_hash{$$process{command}} );
|
||||
delete( $pid_hash{$pid} );
|
||||
}
|
||||
if ( 0 ) {
|
||||
killAll( 5 );
|
||||
}
|
||||
dPrint( ZoneMinder::Logger::INFO, "Server shutdown at "
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime() )
|
||||
."\n"
|
||||
|
@ -653,8 +666,7 @@ sub check {
|
|||
my $daemon = shift;
|
||||
my @args = @_;
|
||||
|
||||
my $command = $daemon;
|
||||
$command .= ' '.join( ' ', ( @args ) ) if ( @args );
|
||||
my $command = join( ' ', $daemon, @args );
|
||||
my $process = $cmd_hash{$command};
|
||||
if ( !$process ) {
|
||||
cPrint( "unknown\n" );
|
||||
|
@ -662,7 +674,7 @@ sub check {
|
|||
cPrint( "pending\n" );
|
||||
} else {
|
||||
my $cpid = $process->{pid};
|
||||
if ( !$pid_hash{$cpid} ) {
|
||||
if ( ! $pid_hash{$cpid} ) {
|
||||
cPrint( "stopped\n" );
|
||||
} else {
|
||||
cPrint( "running\n" );
|
||||
|
@ -675,28 +687,27 @@ sub status {
|
|||
my @args = @_;
|
||||
|
||||
if ( defined($daemon) ) {
|
||||
my $command = $daemon;
|
||||
$command .= ' '.join( ' ', ( @args ) ) if ( @args );
|
||||
my $command = join( ' ', $daemon, @args );
|
||||
my $process = $cmd_hash{$command};
|
||||
if ( !$process ) {
|
||||
if ( ! $process ) {
|
||||
dPrint( ZoneMinder::Logger::DEBUG, "'$command' not running\n" );
|
||||
return();
|
||||
}
|
||||
|
||||
if ( $process->{pending} ) {
|
||||
dPrint( ZoneMinder::Logger::DEBUG, "'$process->{command}' pending at "
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{pending}) )
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{pending} ) )
|
||||
."\n"
|
||||
);
|
||||
} else {
|
||||
my $cpid = $process->{pid};
|
||||
if ( !$pid_hash{$cpid} ) {
|
||||
if ( ! $pid_hash{$cpid} ) {
|
||||
dPrint( ZoneMinder::Logger::DEBUG, "'$command' not running\n" );
|
||||
return();
|
||||
}
|
||||
}
|
||||
dPrint( ZoneMinder::Logger::DEBUG, "'$process->{command}' running since "
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started}) )
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started} ) )
|
||||
.", pid = $process->{pid}"
|
||||
);
|
||||
} else {
|
||||
|
@ -712,11 +723,11 @@ sub status {
|
|||
foreach my $process ( values( %cmd_hash ) ) {
|
||||
if ( $process->{pending} ) {
|
||||
dPrint( ZoneMinder::Logger::DEBUG, "'$process->{command}' pending at "
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{pending}) )
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{pending} ) )
|
||||
."\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
} # end foreach process
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ static deinterlace_4field_fptr_t fptr_deinterlace_4field_gray8;
|
|||
/* Pointer to image buffer memory copy function */
|
||||
imgbufcpy_fptr_t fptr_imgbufcpy;
|
||||
|
||||
Image::Image()
|
||||
{
|
||||
Image::Image() {
|
||||
if ( !initialised )
|
||||
Initialise();
|
||||
width = 0;
|
||||
|
@ -91,8 +90,7 @@ Image::Image()
|
|||
text[0] = '\0';
|
||||
}
|
||||
|
||||
Image::Image( const char *filename )
|
||||
{
|
||||
Image::Image( const char *filename ) {
|
||||
if ( !initialised )
|
||||
Initialise();
|
||||
width = 0;
|
||||
|
@ -798,13 +796,13 @@ bool Image::ReadJpeg( const char *filename, unsigned int p_colours, unsigned int
|
|||
#endif
|
||||
} else {
|
||||
/* Assume RGB */
|
||||
/*
|
||||
/*
|
||||
#ifdef JCS_EXTENSIONS
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
#else
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
#endif
|
||||
*/
|
||||
*/
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
|
||||
}
|
||||
|
@ -928,13 +926,13 @@ bool Image::WriteJpeg( const char *filename, int quality_override, struct timeva
|
|||
#endif
|
||||
} else {
|
||||
/* Assume RGB */
|
||||
/*
|
||||
/*
|
||||
#ifdef JCS_EXTENSIONS
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
#else
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
#endif
|
||||
*/
|
||||
*/
|
||||
cinfo->in_color_space = JCS_RGB;
|
||||
}
|
||||
break;
|
||||
|
@ -946,20 +944,20 @@ bool Image::WriteJpeg( const char *filename, int quality_override, struct timeva
|
|||
cinfo->dct_method = JDCT_FASTEST;
|
||||
|
||||
jpeg_start_compress( cinfo, TRUE );
|
||||
if ( config.add_jpeg_comments && text[0] )
|
||||
{
|
||||
if ( config.add_jpeg_comments && text[0] ) {
|
||||
jpeg_write_marker( cinfo, JPEG_COM, (const JOCTET *)text, strlen(text) );
|
||||
}
|
||||
// If we have a non-zero time (meaning a parameter was passed in), then form a simple exif segment with that time as DateTimeOriginal and SubsecTimeOriginal
|
||||
// No timestamp just leave off the exif section.
|
||||
if(timestamp.tv_sec)
|
||||
{
|
||||
#define EXIFTIMES_MS_OFFSET 0x36 // three decimal digits for milliseconds
|
||||
#define EXIFTIMES_MS_LEN 0x03
|
||||
#define EXIFTIMES_OFFSET 0x3E // 19 characters format '2015:07:21 13:14:45' not including quotes
|
||||
#define EXIFTIMES_LEN 0x13 // = 19
|
||||
#define EXIF_CODE 0xE1
|
||||
#define EXIFTIMES_MS_OFFSET 0x36 // three decimal digits for milliseconds
|
||||
#define EXIFTIMES_MS_LEN 0x03
|
||||
#define EXIFTIMES_OFFSET 0x3E // 19 characters format '2015:07:21 13:14:45' not including quotes
|
||||
#define EXIFTIMES_LEN 0x13 // = 19
|
||||
#define EXIF_CODE 0xE1
|
||||
|
||||
// This is a lot of stuff to allocate on the stack. Recommend char *timebuf[64];
|
||||
char timebuf[64], msbuf[64];
|
||||
strftime(timebuf, sizeof timebuf, "%Y:%m:%d %H:%M:%S", localtime(&(timestamp.tv_sec)));
|
||||
snprintf(msbuf, sizeof msbuf, "%06d",(int)(timestamp.tv_usec)); // we only use milliseconds because that's all defined in exif, but this is the whole microseconds because we have it
|
||||
|
@ -971,8 +969,8 @@ bool Image::WriteJpeg( const char *filename, int quality_override, struct timeva
|
|||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0x00 };
|
||||
memcpy(&exiftimes[EXIFTIMES_OFFSET], timebuf,EXIFTIMES_LEN);
|
||||
memcpy(&exiftimes[EXIFTIMES_MS_OFFSET], msbuf ,EXIFTIMES_MS_LEN);
|
||||
jpeg_write_marker (cinfo, EXIF_CODE, (const JOCTET *)exiftimes, sizeof(exiftimes) );
|
||||
memcpy(&exiftimes[EXIFTIMES_MS_OFFSET], msbuf, EXIFTIMES_MS_LEN);
|
||||
jpeg_write_marker( cinfo, EXIF_CODE, (const JOCTET *)exiftimes, sizeof(exiftimes) );
|
||||
}
|
||||
|
||||
JSAMPROW row_pointer; /* pointer to a single row */
|
||||
|
@ -1081,13 +1079,13 @@ bool Image::DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, unsigned int
|
|||
#endif
|
||||
} else {
|
||||
/* Assume RGB */
|
||||
/*
|
||||
/*
|
||||
#ifdef JCS_EXTENSIONS
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
#else
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
#endif
|
||||
*/
|
||||
*/
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
new_subpixelorder = ZM_SUBPIX_ORDER_RGB;
|
||||
}
|
||||
|
@ -1185,13 +1183,13 @@ bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_over
|
|||
#endif
|
||||
} else {
|
||||
/* Assume RGB */
|
||||
/*
|
||||
/*
|
||||
#ifdef JCS_EXTENSIONS
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
cinfo->out_color_space = JCS_EXT_RGB;
|
||||
#else
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
#endif
|
||||
*/
|
||||
*/
|
||||
cinfo->in_color_space = JCS_RGB;
|
||||
}
|
||||
break;
|
||||
|
@ -2007,18 +2005,14 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int
|
|||
}
|
||||
}
|
||||
|
||||
void Image::Timestamp( const char *label, const time_t when, const Coord &coord, const int size )
|
||||
{
|
||||
void Image::Timestamp( const char *label, const time_t when, const Coord &coord, const int size ) {
|
||||
char time_text[64];
|
||||
strftime( time_text, sizeof(time_text), "%y/%m/%d %H:%M:%S", localtime( &when ) );
|
||||
char text[64];
|
||||
if ( label )
|
||||
{
|
||||
if ( label ) {
|
||||
snprintf( text, sizeof(text), "%s - %s", label, time_text );
|
||||
Annotate( text, coord, size );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Annotate( time_text, coord, size );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue