You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

IdGenOptions.c 950 B

4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * 版权属于:yitter(yitter@126.com)
  3. * 开源地址:https://github.com/yitter/idgenerator
  4. */
  5. #include "IdGenOptions.h"
  6. extern IdGeneratorOptions BuildIdGenOptions(uint32_t workerId) {
  7. IdGeneratorOptions options;
  8. options.Method = 1;
  9. options.BaseTime = 1582136402000;
  10. options.WorkerId = workerId;
  11. options.WorkerIdBitLength = 6;
  12. options.SeqBitLength = 6;
  13. options.MaxSeqNumber = 0;
  14. options.MinSeqNumber = 5;
  15. options.TopOverCostCount = 2000;
  16. return options;
  17. // IdGeneratorOptions *options = (IdGeneratorOptions *) malloc(sizeof(IdGeneratorOptions));
  18. //
  19. // options->Method = 1;
  20. // options->BaseTime = 1582136402000;
  21. // options->WorkerId = workerId;
  22. // options->WorkerIdBitLength = 6;
  23. // options->SeqBitLength = 6;
  24. // options->MaxSeqNumber = 63;
  25. // options->MinSeqNumber = 5;
  26. // options->TopOverCostCount = 2000;
  27. //
  28. // return options;
  29. }