Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set date and time #3

Open
phlegx opened this issue Feb 25, 2016 · 5 comments
Open

How to set date and time #3

phlegx opened this issue Feb 25, 2016 · 5 comments

Comments

@phlegx
Copy link

phlegx commented Feb 25, 2016

Any idea how to set date and time?

@ztzhang
Copy link
Owner

ztzhang commented Feb 26, 2016

Good Question! I do find a command to set time and date, but haven't got time to test it. I will add it later.

@s-hemer
Copy link

s-hemer commented Nov 6, 2017

Referring to joshvillbrandt/goprohero#5 , https://github.com/KonradIT/goprowifihack/blob/master/HERO4/gpControl-Hero4Silver.json#L2848 and some own captures on my mobile phone with the GoPro app setting the time for a Hero4, it works a as follows:

http://10.5.5.9/gp/gpControl/command/setup/date_time?p=%11%0b%06%11%2a%00

whereupon the numbers are hex-coded. So the above command sets time to %11= (20)17, %0b=11 => November, ...

@s-hemer
Copy link

s-hemer commented Nov 6, 2017

Her also a short bash script to do so:

#!/bin/bash

TIME_STRING=$(printf "%%%02x%%%02x%%%02x%%%02x%%%02x%%%02x" $(date +%y_%m_%d_%H_%M_%S | sed 's/_/ /g'))

curl "http://10.5.5.9/gp/gpControl/command/setup/date_time?p=${TIME_STRING}"

s-hemer added a commit to s-hemer/bash-gopro that referenced this issue Nov 16, 2017
@s-hemer
Copy link

s-hemer commented Nov 16, 2017

For the C++ guys:

char time_string[18];
auto t = std::chrono::system_clock::now();
auto tm = std::localtime(&t);

std::sprintf(time_string, "%%%02x%%%02x%%%02x%%%02x%%%02x%%%02x", tm->tm_year % 100, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);

curl_easy_setopt(curl, CURLOPT_URL, "http://10.5.5.9/gp/gpControl/command/setup/date_time?p=" + std::string(time_string));

@hkskoglund
Copy link

Alternative command:
TIME_STRING=$(printf '%%%02x' $(date +'%_y %_m %_d %_H %_M %_S'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants