Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
time. strftime
#1
Hi i am new in this blog and would like to answer a few question.
first of all my name is jorge and i am an enginiering student, so i am working on a project with a dron which runs 2 cameras using a raspeberry pi.
the RPI runs an script with the following loop

import RPi.GPIO as gpio
import time
import sys
import os
from picamera import PiCamera
from subprocess import call
import sys

while True:
    status=gpio.input(06) #chequeo del pin GPIO 06
    if status == False: #si se recibe un puslo se pasa a toma de imagenes
        i=i+1 #actualizacion de contador 
        tiempo=time.strftime("%H-%M-%S") #llamada al tiempo actual en formato 24 horas 
        camera.capture("/home/pi/Desktop/CarpetaCompartidaPRUEBA/RGB/imagenRGB%s.jpg" %tiempo) #captura de imagen con RaspiCAM, etiquetado con la hora del  disparo correspondiente, guardado en carpeta compartida
        capturaVUE() #captura de imagen con cámara FLIR VUE PRO, la imagen se guarda en un directorio dentro de la microSD de la cámara a la que se accede mediante USB 
so the problems happens when i go outside to fly the dron, the script runs perfectly all the way to the end, but the images are being saved with an incorrect hour, minute (actually the same hour as i leave the office more or less)

do you know what the problem may be ?
and also i would like to know how the time.strftime function is able to determine hour, by using wifi conection or how ?
ty in advanced
Reply
#2
also import datetime
then:
>>> tiempo = datetime.datetime.today()
>>> s = tiempo.strftime("%H-%M-%S")
>>> s
'10-48-53'
>>>
and a bit later:
>>> tiempo = datetime.datetime.today()
>>> s = tiempo.strftime("%H-%M-%S")
>>> s
'10-50-49'
>>>
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  calling strftime does not display current time tonytech 2 2,144 May-05-2020, 04:53 AM
Last Post: tonytech
  looping through every strftime in HHMMSS format yatinydalvi 5 4,742 Sep-28-2017, 09:33 PM
Last Post: Yoda

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020