2

I've recently jailbreaked my kindle to make it a clock that shows a certain image for each minute of the day. I used the instructions mentioned in this article

https://www.instructables.com/Literary-Clock-Made-From-E-reader/

The thing is to do this there is a scribt to make it work, in the script it shows this code for getting the timezone

#!/bin/bash
test -f /mnt/us/timelit/clockisticking || exit
MinuteOTheDay="$(env TZ=CEST date -R +"%H%M")";

The thing is, whenever I put in my time zone, which is GMT+4, it never shows the correct time. Even if the time is set correctly on the kindle, it just keeps using its own time.

I tried

MinuteOTheDay="$(env TZ=GMT+4 date -R +"%H%M")";

and

MinuteOTheDay="$(env TZ=Asia/Muscat date -R +"%H%M")";

and

MinuteOTheDay="$(env TZ=GST date -R +"%H%M")";

and they didn't give the correct time, is there a way around this, am I missing something? Is there a way to make the script take the time from the kindle time?

9
  • Could you show the output that you get and the output that you expected to get? Is there a reason you're using the -R option with date? Could you try using Etc/GMT-4?
    – Kusalananda
    May 18 at 9:41
  • I don't see an output in the kindle as it executes it. It is supposed to take the hour and minute and look for a corresponding png image for that hour and minute and display it as the time. as for the -R I have no idea what is the reason. I didn't write the original code and I'm familiar with it May 18 at 9:47
  • Why do you run env? Also why do you provide two formats to date? date alone raises error for me for two formats. Please update with the exact output you get if you run your command.
    – thanasisp
    May 18 at 9:49
  • 1
    I wonder if the Kindle uses busybox and its built-in date utility, which is not really made for date formatting tasks. Do you know what OS (more specifically) and toolset you are actually working with here?
    – Kusalananda
    May 18 at 10:07
  • 1
    I have added the busybox tag. If I was wrong, please remove it.
    – thanasisp
    May 18 at 16:20

2 Answers 2

1

There was something going wrong in the kindle, no matter how much I tried to solve it or change the timezone. but what worked is adding this line

MinuteOTheDay=$(expr \( $MinuteOTheDay + 400 \) % 2400)

as suggested by Archemar

So full solution is (start with)

#!/bin/bash
test -f /mnt/us/timelit/clockisticking || exit
MinuteOTheDay=$(date +%H%M)
MinuteOTheDay=$(expr \( $MinuteOTheDay + 400 \) % 2400)
1
  • I add full solution, I also edit question title as I think knidle (or at least busbox is a key point)
    – Archemar
    May 18 at 11:47
-1

Use GMT0, and consider the difference between that timezone relative to you, which is -4hrs:

MinuteOTheDay="$(env TZ=GMT0-4 date -R +"%H%M")";

Based on this answer: https://unix.stackexchange.com/a/642964/473564

3
  • Same issue, it shows 10.07 am when it is 14:07 PM :"( May 18 at 10:08
  • Ok, I guess there is some issue with the clock because here it shows 14hrs, a workaround could be just adding the time difference as an offset, ej: MinuteOTheDay="$(env TZ=GMT0+10 date -R +"%H%M")"; May 18 at 10:14
  • 1
    It didn't I've tried as many as I can do. someone suggested this fix and it worked add MinuteOTheDay=$(expr ( $MinuteOTheDay + 400 ) % 2400) in a second line May 18 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.