Something like this should work:
#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>
char logString[30];
int beeCounterA = 0;
int lastBeeCounterA = 0;
int beeCounterB = 0;
int lastBeeCounterB = 0;
time_t t;
void setup()
{
setSyncProvider(RTC.get);
//open the card and logfile, and do the rest of your setup
}
void loop()
{
//do whatever you do to read the counter devices
if ((beeCounterA != lastBeeCounterA) || (beeCounterB != lastBeeCounterB))
{
t = now();
sprintf(logString,"%.2d/%.2d/%.4d %.2d:%.2d:%.2d,%.3d,%.3d",
month(t), day(t), year(t), hour(t), minute(t), second(t), beeCounterA, beeCounterB);
logFile.println(logString);
lastBeeCounterA = beeCounterA;
lastBeeCounterB = beeCounterB;
}
}
This logs complete date and time as mm/dd/yyyy hh:mm:ss, and gives three digits for both counters--you can adjust the sprintf statement to give a different format if you prefer. This will only log to the file when there's been a change in either beeCounterA or beeCounterB, and at that time it will log the date and time, and both counters.
This code isn't complete; I don't have the library or the code in there to open the SD card, create and open the file, read the counter devices, etc. But it should get you going.