Giter VIP home page Giter VIP logo

Comments (7)

babca avatar babca commented on August 15, 2024

probably fixed in the latest commit, please test.

from python-gsmmodem.

tomchy avatar tomchy commented on August 15, 2024

I was able to reproduce your issue inside unittest (based on provided responses). Probably your modem sends invalid time zone data (0x2C).

@fredyrommy What is your time zone? Should it be +10.5? Maybe +11?

from python-gsmmodem.

babca avatar babca commented on August 15, 2024

Maybe the negative sign is placed in the wrong nibble by the modem?
0x2C --> 0010 1100 --> remove sign from the second nibble -0010 0100 = 0x24 negative * 0.25 = -9h timezone.
https://en.wikipedia.org/wiki/Binary-coded_decimal#Signed_variations

Maybe this bit just should be ignored, then it would mean +9h.

@fredyrommy please let us know your timezone :-) Is it -9 or +9?

from python-gsmmodem.

tomchy avatar tomchy commented on August 15, 2024

Currently time zone value is shifted back:
0xC2 --> 0x2C --> 0xC2 --> 0x42
And afterwards:
0x42 --> 42 * 15 / 60 --> -10h

Edit:
I just found that it was too late and I made a mistake:

tzHexVal = int((tzHexVal & 0x0F) * 0x10) + int((tzHexVal & 0x0F) / 0x10)

instead of:

tzHexVal = int((tzHexVal & 0x0F) * 0x10) + int((tzHexVal & 0xF0) / 0x10)

I will fix that (and add check for parsed value inside unit test) as soon as @fredyrommy will confirm time zone. 🙂

from python-gsmmodem.

tomchy avatar tomchy commented on August 15, 2024

According to the country code used inside your data (+62) it should be Indonesia, which has three time zones: +7, +8 and +9. Additionally, one of timestamps is decoded correctly by an old code (2016-10-30 04:59:44+07:00), so I assume it should be close to +7.

Values 0x2C and 0x28 have small difference, so I thought that someone forgot about BCD-check:

0x2C + 0x06 = 0x32 --> 32 * 15min / 1hr = +8

@fredyrommy Is it correct?
This hot fix could be found in a8b449d.

from python-gsmmodem.

enviel avatar enviel commented on August 15, 2024

yes my timezone is UTC +7 Jakarta, Indonesia

from python-gsmmodem.

babca avatar babca commented on August 15, 2024

@fredyrommy is your issue now resolved? (see #42; download v0.12 release or clone repo)

from python-gsmmodem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.